Lunarpages Web Hosting Forum

Scripting Languages Hosting Help => PHP and MySQL Support => Topic started by: Ed on January 20, 2005, 09:45:30 AM

Title: Developing locally on your own local PHP/MySQL/Apache server
Post by: Ed on January 20, 2005, 09:45:30 AM
Its easier than you might think!

I setup a dedicated local server once to let me do this but it turns out there is an even faster easier way to do it :)

http://www.easyphp.org/

 EasyPHP is a complete software package allowing to use all the power and the flexibility that offers the dynamic language PHP and the effecient use of databases under Windows. Package includes an Apache server, a MySQL database, a fully PHP execution, as well as easy development tools for your web site or your applications.

Best part - its a one click install on your local system :)

- Ed
Title: Developing locally on your own local PHP/MySQL/Apache server
Post by: GarveysIT on January 20, 2005, 10:29:31 AM
used thius before, i liked it, but then i reinstalled the whole of windows and forgot about it, thanks Ed
Title: Developing locally on your own local PHP/MySQL/Apache server
Post by: deadly_risk on January 20, 2005, 11:14:16 AM
xampp works well for this purpose too. Also includes addons phpMyAdmin, and a few other nifty things.
Title: Developing locally on your own local PHP/MySQL/Apache server
Post by: Ed on January 20, 2005, 01:46:04 PM
This one includes phpMyAdmin as well.
Title: Developing locally on your own local PHP/MySQL/Apache server
Post by: Nicki Faulk on January 20, 2005, 02:43:21 PM
I swear, phpMyAdmin is a God-send!  I'm so spoiled, I'm already forgetting the "type in" MySQL commands, I had to look them up this weekend for help on a friend's box.  LOL
Title: Re: Developing locally on your own local PHP/MySQL/Apache se
Post by: begeiste on March 18, 2005, 11:09:43 AM
Do you have a easy instruction for setting up a local server once on Mac OS 10? Thanks.



Quote from: Ed
Its easier than you might think!

I setup a dedicated local server once to let me do this but it turns out there is an even faster easier way to do it :)

http://www.easyphp.org/

 EasyPHP is a complete software package allowing to use all the power and the flexibility that offers the dynamic language PHP and the effecient use of databases under Windows. Package includes an Apache server, a MySQL database, a fully PHP execution, as well as easy development tools for your web site or your applications.

Best part - its a one click install on your local system :)

- Ed
Title: Developing locally on your own local PHP/MySQL/Apache server
Post by: GMTurner on March 18, 2005, 11:39:06 AM
With MacOSX it's actually even easier since it comes with Apache installed but turned off by default. I think it even includes PHP. If you search through google I'd think you should come up with some easy tutorials on getting it active, adding MySQL, etc.
Title: Developing locally on your own local PHP/MySQL/Apache server
Post by: alienres on April 05, 2005, 12:28:42 PM
visit www.entrophy.ch for Mac OS X installer for PHP 4 and 5. THe site includes a lot of information for configuring PHP on OS X. IT also has info on MYSQL. It is very straight forward
Title: Developing locally on your own local PHP/MySQL/Apache server
Post by: begeiste on April 13, 2005, 04:01:14 PM
Quote from: GMTurner
With MacOSX it's actually even easier since it comes with Apache installed but turned off by default. I think it even includes PHP. If you search through google I'd think you should come up with some easy tutorials on getting it active, adding MySQL, etc.


Really? Have you done so? I did download the EasyPHP1-8 to my Mac OS 10, the exe file isn't executible. But EasyPHP works in the PC very well. Not for Mac, my friend.
Title: Developing locally on your own local PHP/MySQL/Apache server
Post by: GMTurner on April 13, 2005, 04:04:33 PM
Quote from: begeiste
Quote from: GMTurner
With MacOSX it's actually even easier since it comes with Apache installed but turned off by default. I think it even includes PHP. If you search through google I'd think you should come up with some easy tutorials on getting it active, adding MySQL, etc.


Really? Have you done so? I did download the EasyPHP1-8 to my Mac OS 10, the exe file isn't executible. But EasyPHP works in the PC very well. Not for Mac, my friend.


What I was saying is that you don't need EasyPHP on the Mac because Apache and stuff are already installed by default with OSX.... and it stands to reason that a windows executable wouldn't run on MacOSX....
Title: Developing locally on your own local PHP/MySQL/Apache server
Post by: GarveysIT on April 13, 2005, 04:06:03 PM
http://www.macromedia.com/devnet/mx/dreamweaver/articles/php_macintosh.html

see this
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: kypsah on November 09, 2005, 06:28:36 PM
Thanks for the link, Ed!  It was cool to just be able to download everything all at once.

Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: hamburger on November 11, 2005, 03:44:30 PM
One thing to remember when developing locally on a windows machine and then uploading to lunarpages linux servers is CASE SENSITIVITY.
I was doing some php and msql stuff locally and then uploaded to LP, took me a while to realise I hadn't been consistent with the casing of my table columns  adn thats why it wouldnt work :(
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: landing on November 11, 2005, 04:30:28 PM
Quick enquiry


Whilst developing locally, is there a setting in php.ini or elsewhere to turn off the hideous undefined index errors?

It's annoying that I have to first check if a variable is set before playing with it. I don't have to do this on my LP site.


Cheers


Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: Nibbler on November 11, 2005, 05:01:09 PM
Yeah, check the error_reporting setting.
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: Ed on November 12, 2005, 06:01:32 AM
By default the error reporting is set to display all errors and all warnings.

Do a phpinfo()  on LP if you want to mimic their setup for development.

- Ed
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: landing on November 12, 2005, 06:18:27 AM
Lovely stuff.

Thanks Nibbler & Ed.


Cheers
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: landing on November 12, 2005, 08:12:32 AM
Is it possibly to download or extract a copy of the LP php.ini?

Would save me hours of comparing and amending settings.


Cheers
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: Nibbler on November 12, 2005, 08:49:14 AM
First of all disable your custom php.ini if you have one. Then do a phpinfo() which will tell you where the main php.ini file is located on your server. You can then upload and run a php script to copy the file into your home directory for examination. Here's an example, change the paths to suit

Code: [Select]
<?php
passthru
('cp /usr/local/Zend/etc/php.ini ~/server.php.ini');
?>


You probably won't want to use it as it is, as some settings may break your local setup.
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: landing on November 12, 2005, 09:41:44 AM
Thanks Nibbler. I'll take a look.
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: oxsley on November 23, 2005, 08:00:44 PM
For testing purposes, here's a trick I use.... I create a test directory and test files on the live server. But, just before I upload the new test stuff, I edit my .htaccess file to restrict all IP addresses to the test stuff except mine. Something like:

# Restrict access to test directory
RewriteCond %{REQUEST_URI} ^/testdirectory/.*$
RewriteCond %{REMOTE_ADDR} !^12\.345\.678\.999$
RewriteRule .*$ index.html

Basically, this translates as:
Line 1: If the request is for anything in the test directory (testdirectory), and
Line 2: If the request is not from your IP address (12.345.678.999)
Line 3: Re-direct all requests (.*$) to the home page (index.html)

There are other variations, such as you could redirect to a 401 page. The exact edits to your .htaccess file may be slightly different based on what you already have in there. Of course, you'll want to set things back when you are done testing. This trick is probably best for small-scale tests. And, editing your .htaccess file can be tricky... it's easy to make a mistake and mess up access to your site.
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: Tom Veik on December 11, 2005, 06:45:18 PM
I have PHP MySQL and Apache running in my home windows pc to do testing, but I don't have mod rewrite.  How do I add that?  Does that require a recompile of the EXE?
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: Tom Veik on December 11, 2005, 08:01:54 PM
Never mind, figured it out.  All I had to do was un-comment a couple lines in httpd.conf.
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: MrPhil on April 18, 2006, 11:51:04 AM
xampp works well for this purpose too. Also includes addons phpMyAdmin, and a few other nifty things.

I'm trying to set up LAMPP (XAMPP for Linux) and am having trouble with Perl. I can't run a Perl script either from the URL or via a PHP page. Please see http://www.lunarforums.com/forum/index.php?topic=21408.msg243673#msg243673 for details, if you have any experience with this.

Thanks! Phil
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: hamburger on April 18, 2006, 03:36:54 PM
@Mr Phill
I just installed xampp last night on my kubuntu machine, i was surprised how easy it was to set up.

Unfortionatly I will be having to do some Perl stuff soon so I'll let you know if I get it going.

One thing to try.
change $otherpage to have a local path instead of a URL.
from http://nz2.php.net/fopen
Quote
If PHP has decided that filename specifies a registered protocol, and that protocol is registered as a network URL, PHP will check to make sure that allow_url_fopen is enabled. If it is switched off, PHP will emit a warning and the fopen call will fail.

Check that the directories have permissions 777.
I found that on lunarpages 755 worked, but 755 didn't work on my local machine.

hope that might help
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: MrPhil on April 19, 2006, 01:58:59 PM
Thanks for the tips, BigBirdFluHuman :-). I'll give 'em a try. Except for the Perl problem, XAMPP has been a very nice testbed for development (so far). It's nice not to have to upload everything to LP and worry about some infinite loop during debugging getting me banished...
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: officexpboy on June 23, 2006, 01:58:17 AM
WAMP  (software bundle) is tool that we can use as development server. Can be offline, only localhost (your computer) can access to your server.
WAMP is acronym for Windows, Apache, MySQL and  PHP.

WAMP5 - contains MySQL 5.0.22, Apache 2.0.58, phpmyadmin 2.8.1) as well as PHP4, MySQL administration and Zend Optimizer add-ons.


I guess WAMP is better option

http://www.wampserver.com/en/
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: JaphyR on June 23, 2006, 01:34:28 PM
I have an unanswered question that I've been ignoring for a while.  I installed PHPerl on my machine a while ago, to have a local testing environment, and it has been very satisfying.  I never did anything, though, to ensure that the server on my laptop is inaccessible to anyone throughmy internet connection.

Is there anything I'm supposed to do that will restrict any and all use of this server to my computer, like changing ports or permissions?
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: GMTurner on June 23, 2006, 08:20:25 PM
One thing that provides some degree of protection, is the Windows firewall (if you have XP that is...) I wouldn't say it is the best out there, but as long as you do not allow the computer to accept outside connections you should be alright... to be better off, use a product like ZoneAlarm (or other firewall) as an added layer of protection... make sure file sharing is turned off, etc...

And of course the best way at all, don't connect to the internet, but that's always seemed a bit extreme to me :)
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: Urashmi on June 24, 2006, 05:33:06 AM
I have an unanswered question that I've been ignoring for a while.  I installed PHPerl on my machine a while ago, to have a local testing environment, and it has been very satisfying.  I never did anything, though, to ensure that the server on my laptop is inaccessible to anyone throughmy internet connection.

Is there anything I'm supposed to do that will restrict any and all use of this server to my computer, like changing ports or permissions?

You must ensure there is a firewall between you and the internet, not just for PHPerl, an unprotected PC will be hacked in no time.  Win XP sp2 has a firewall built in, but I recommend using a separate device (e.g. an old 486 PC can easily be configured to act as a firewall), or if you have a broadband connection use a firewall/router/modem, they cost little more than a modem.
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: JaphyR on June 25, 2006, 10:26:32 AM
Thanks for the advice; I checked, and my system is set up to not accept outside connections.  I feel a little better now.  (We always do before the crash, don't we?  8-) )
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: mark363 on August 10, 2006, 05:37:59 PM
One thing to remember when developing locally on a windows machine and then uploading to lunarpages linux servers is CASE SENSITIVITY.
I was doing some php and msql stuff locally and then uploaded to LP, took me a while to realise I hadn't been consistent with the casing of my table columns  adn thats why it wouldnt work :(

UGH! Yes. This is what I should have read a week ago. >_<

And make sure your versions of PHP and MySQL are consistent, or that your code works with both. When exporting MySQL databases for your remote server, use MySQL 4 compatibility.
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: lunarofftime on January 26, 2008, 08:15:31 AM


Ed, I used Easy PHP and I liked it a lot. I want to ask if there is package that supports PHP4 too, some scripts I may use needs it. If not, please recommend the best package to develope locally for PHP4 scripts.
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: James10c on June 01, 2009, 12:02:53 PM
I am from the old school. I am still installing all of them myself!

I want to know how you compare it with WAMP? Pros and Cons?
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: ljonston on June 22, 2009, 11:14:05 AM

(https://bodybuilderspro.info/customimages/65/1240197088/random.gif)
Ed, I used Easy PHP and I liked it a lot. I want to ask if there is package that supports PHP4 too, some scripts I may use needs it. If not, please recommend the best package to develope locally for PHP4 scripts.


I know that for whatever reason the support for PHP4 has been dropped(PHPMyadmin) comes to mind, which kinda sucks.  PHP5 is out and probably is the way to go.  Although, I'm sure there has to be a few packages that still support "4", customs are out there. 
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: ichsie on November 19, 2009, 01:06:23 AM
Its easier than you might think!

I setup a dedicated local server once to let me do this but it turns out there is an even faster easier way to do it :)

http://www.easyphp.org/

 EasyPHP is a complete software package allowing to use all the power and the flexibility that offers the dynamic language PHP and the effecient use of databases under Windows. Package includes an Apache server, a MySQL database, a fully PHP execution, as well as easy development tools for your web site or your applications.

Best part - its a one click install on your local system :)

- Ed

I prefer wampserver: http://www.wampserver.com/en/

I used to use easyphp until I had some unsolvable problems. Had to switch to wampserver and everything was fine since.
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: Lunartique on February 01, 2011, 10:09:48 AM
I work with WAMPSERVER. Everything is available at same place. It includes PHP5, Apache server, MySQL and PHPMyAdmin so the development is very easy. you can download WAMPSERVER from http://www.wampserver.com/en/
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: watsonovedades on February 07, 2011, 01:40:55 AM
Hey man

Can i have a WAMPSERVER  versiona in spanish? i cant find it anywhere

Cheers
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: webdeveloper on May 26, 2011, 10:54:16 PM
Hey man

Can i have a WAMPSERVER  versiona in spanish? i cant find it anywhere

Cheers

have you try Wampserver.en.malavida.com ?
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: smartkathy on January 13, 2012, 05:12:38 AM
Hey,

Thank you for sharing this. Heard about it, but never really checked it out.
Cheers.
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: jimlongo on April 25, 2012, 11:38:15 AM
Even easier is to install MAMP (http://www.mamp.info/en/index.html) on a Mac to take advantage of what's already installed.  It also gives you phpmyadmin and other tools.
Combine that with ln IDE like Netbeans (http://netbeans.org/) and you have everything you need for php development.
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: MrPhil on April 25, 2012, 01:34:56 PM
Please note that the referenced post by @GMTurner is over 7 years old, and the information therein may be obsolete. In general, I would recommend verifying such information before quoting, and including a correction if it is now incorrect.
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: ericlewis107 on May 28, 2012, 04:06:49 AM
I have PHP MySQL and Apache running in my home windows pc to do testing, but I don't have mod rewrite.  How do I add that?  Does that require a recompile of the EXE?
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: MrPhil on May 28, 2012, 06:14:08 AM
My guess would be that mod_rewrite is a module that needs to be compiled and linked into the server (Apache). I would ask on a support forum for whatever specific package you use (WAMPP, XAMPP, LAMPP, etc.).

Have you tried enclosing the rewrite section in .htaccess with something like
Code: [Select]
<IfModule mod_rewrite.c> ... </IfModule>? I think that's the right syntax, but you should check. You might have mod_rewrite, and just need to explicitly invoke it.
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: annaharris on April 01, 2013, 05:10:27 AM
It is good to develop website on your own local PHP/Mysql/Apache server. Thanks for sharing the information.
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: sarah25 on July 17, 2013, 08:38:34 PM
xampp works well for this purpose too. Also includes addons phpMyAdmin, and a few other nifty things.



<spam link removed>
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: appdeveloper on November 23, 2018, 02:38:51 AM
It is ok to develop locally on your local PHP or my SQL or Apache server but keep case sensitivity in mind.
Title: Re: Developing locally on your own local PHP/MySQL/Apache server
Post by: MrPhil on December 15, 2018, 04:02:51 PM
I generally advise against developing on your PC (*AMPP local server) unless you fall into one of the two following groups:

In any case, never try to host a real live site (accessible by the Web) on your PC, especially if it's ecommerce or otherwise involving money or sensitive information. Rest assured that hackers out there know far more about security issues than you ever will, and will attack you and eat your lunch the minute you go live. Hosts (such as Lunarpages) put a great deal of time and effort into protecting their customers against attack -- it's not foolproof, but wouldn't you rather be doing something else than babysitting your server 24-7? Besides, you're committing to keeping your PC running 24-7; you can't turn it off or do any work on it that would disrupt the server.

The big problem with developing on a local server (*AMPP) and then transferring it to a commercial server is that the version of everything will be different. Your local server might have PHP 7.2 or even 7.3, and if you develop to that standard and then transfer it to a PHP 5.6 commercial server, you could have lots of fixing to do. Same thing for MySQL and Apache levels. It's not to say that it's impossible to develop and test on a local server, but you have to constantly keep in mind what your target system's software levels are, and write to them. It rarely turns out that you FTP your files over and bang!, you're running. Sometimes you find you've accidentally used an advanced language feature that won't be available for years on your commercial server. That can be quite a bit of rework, and you don't want your site down. At the least, you should test your revised site in its own, private test directory (which can be password-protected). Don't assume that your code which runs fine on your local server will immediately run fine on your real server!

Some will argue that you save file transfer time and effort by editing/developing and then testing on the same machine. You can edit a file and then immediately run it, rather than having to upload it first. To each his own. Keeping an FTP client window open saves startup time. Having the (slightly) older version on the commercial server can act as a backup if you make a serious error handling or editing files on your PC. Having to take one extra step (upload) can be a disciplinary aid to make you stop and think for a moment whether your revised code is really ready. It almost comes down to "six of one, a half-dozen of the other".

If you're a computer pro and live and breathe complex software, you might enjoy installing and maintaining a local server. If you're not a pro, you'll have a lot to learn before you can do anything useful -- is that how you want to spend your time? It's up to you!