Installing a lightweight PHP dev server

I have written before about creating a live chart based on Google Charts API. This post is for those who are new at this, or non technical.

If you just wish to try out your PHP and use it locally, I recommend EasyPHP. It is a dev server, so you cannot publish your pages to the web, however I recommend you do not create a webserver from a personal PC anyway, unless you are willing to lose all your local data. You can get the devserver here.

Download and install it, and remember where you install it. If you are using windows, make sure that your windows user has the right to access and modify files at the installation path (Would recommend installing it outside of c://program files)

 

Changing the default port to avoid clashes with other software:

The default port for your new dev server will be port 80. A lot of other software (even skype) can use that port by default, so I would change it right away before any clashes occur. In the install folder, under binaries/conf_files folder  you will find a file called httpd.conf . Open the file in a text editor such as notepad, and look for the text  ‘Listen 127.0.0.1:80’ and ‘ServerName 127.0.0.1:80’ . Here we can see the port  that we have to change (:80) at the end of the IP. Personally, I like to start from 8079 and go down, as some software has 8080 as default. Change the port to 8079, so now the ip will look like 127.0.0.1:8079 .

‘Uploading’ files:

Every web server has a root folder for its files, in the case of EasyPhp it will be installfolder\data\localweb . You can create folders there to place your PHP files, and then access them through your browser. For example, I have a ‘charts’ folder, with the file chart.php inside.

I would access by typing 127.0.0.1:8079/charts/chart.php in my address bar. If you want to troubleshoot your file, you can view the source by accessing ‘view-source:127.0.0.1:8079/charts/chart.php’

EasyPHP
Accessing your PHP file

If you want to make this content accessible online, I bid you not to do so from your local computer. But if you really need to, you can install XAMPP web server. Easyphp is for local access only. I only use it to create files and test them locally, and once they are done I move them to my hosted web server. A host is cheap, so don’t put your personal computer at risk. Besides, most home internet service providers will give you a very limited bandwidth for uploading, so when somebody tries to access your locally hosted webpage, it will load incredibly slow.

Have fun with your PHP files!