Research Documentation 03 Local Php

Research Documentation 03 Local Php

03 Local Php

Technique 1 - XAMPP

One way to run PHP locally is to use XAMPP that is available from the Apache Friends site. Once installed, you can use it to run PHP code from either the command prompt or within Visual Studio Code. When using XAMPP, all files need to go in a specific folder so that the program can access them.

Technique 2 - Command Line via php.net download

Another way to run PHP locally is to install PHP to your computer from the download at php.net. This article gave great instructions on how to download, unzip, and set up your system to run php from the command prompt. Programs can be run right from the command line or you can start a server to view in a browser. Additionally, using the php-server plugin for Atom, you can use the Atom software to quickly start a php server to test your files.

Technique 3 - WAMP

A third way to run PHP locally is to use WAMP, a Windows development environment. It lets you test PHP loally but also use MySQL databases. This enviornment was simple to install and use. To get this working you just need to download the file and run the installation. After it is installed, running the program will start the server.

Summary

One advantage to running PHP locally is that it enables you to test your PHP files before they make it onto the web server, allow you to find errors/bugs before they are uploaded. It also is a nice option if you are working without an internet connection. One con to doing this is that it can take some playing around to get the server set up properly and working. But once I got the PHP installed and set up, it was easy to use. One disadvantage to running PHP locally is that the performance may not be as good as on a web server, and the security is not generally as good. In a Stack Overflow discussion thread, many users noted issues with certain functions being buggy and also noting that case sensitivity might vary from the web server you end up using. Overall, running PHP locally is a great way to test out things without having to upload them to a web server. It's relatively easy to get it set up and ready. But not as good of an option when the PHP is larger, more memory intensive, or needs high security.

Sources: