Using Atom as a built-in PHP Development Server


Atom is a popular open-source text editor with color styling, code autocompletion, and other functionality. It comes with support for many programming languages including C, C++, C#, CSS, HTML, Java, and many, many others. Atom has been extended by its community of users through packages that add new features.

Installing Atom

Visiting will try to guess the operating system of the device and prove an appropriate download link. Other versions and supported platforms can also be found on its latest releases page on GitHub.

Once installed, Atom can then be used to write in many different programming languages.

Installing PHP

Unix-based systems like Linux and MacOS X come with PHP installed. For Windows, PHP needs to be downloaded.

Configuring PHP on Windows

Once downloaded, the PHP files should be copied into folder, “C:\php”, that will serve as the root directory for using PHP.

Re-naming the php.ini-development file

In order to run, PHP needs to know what settings to use. The php.ini file lists all of these settings. For development purposes, the php.ini-development file should be renamed php.ini, as it comes with pre-configured settings for a development environment.

Adding PHP to the Windows PATH

In order to use PHP in Windows, it has to be added to the PATH global variable.

For the Start Search, begin to type “env” and then click on “Edit the system environment variables”

On the System Settings windows, click on “Environment Variables…” button in the lower, right-hand corner.

In the lower System variables panel, find “Path” in the listing. Select it and then click the “Edit” button.

Click “New” on the right-hand side. Add “C:\php” (or the folder used for PHP in the earlier step).

Click “OK” to save the new entry and close the “Edit environment variable” and then “System Settings” windows.

Adding php-server to Atom

Open Atom.

Go to Atom -> Preferences or Atom -> Settings (Depending on the operating system, the wording might be different).

From the left-hand options, click on “+Install”

In the search bar, type in “php-server” and click its “Install” button once the php-server package has been found.

Using the PHP Server in Atom

Once PHP has been installed, configured, and can be accessed via the PATH variable by the operating system, it can be invoked by the Atom package.

For a PHP project or file, click on Packages -> PHP Server and then choose either to start the server in the project root, selected folder tree, or for the current file.

Once started, PHP Server will open a web browser for the current option (folder or file).

Any errors will be reported in the Atom log area. The current port and document (project) root will be also be listed.