PHP is a widely-used Open Source general-purpose scripting language that is especially suited for web development and can be embedded into HTML. The application can be run as a Windows Service using FireDaemon Pro, which allows you to have the application start automatically at boot prior to login, start multiple instances of the application and more. This HOWTO will show you how to set it up. You can also use FireDaemon Fusion to manage FireDaemon and other Windows services via a web browser.
PHP Setup Under FireDaemon Pro
Download the latest version of PHP from the official PHP website.
By default PHP installs to C:\PHP so for the purposes of this HOWTO, we will use that directory.
PHP uses 1 configuration file to store its settings. In the PHP root directory, rename "php.ini-optimized" to "php.ini".
PHP has 3 executables you can start it with, php.exe, php-cgi.exe and php-win. For the purposes of this guide and to keep in line with optimization of your initial setup, php-cgi.exe will be used.
Download and install FireDaemon Pro into the directory of your choice, typically C:\Program Files\FireDaemon.
Next start the FireDaemon GUI from the desktop shortcut. Click on the "Create a new service definition" button in the toolbar (or type Ctrl+N) and enter the information into the fields as you see below. Adjust the paths to suit your installation.
- Executable: The path to your php-cgi.exe file. For the purposes of this guide, the path is C:\PHP\php-cgi.exe.
- Working Directory: The directory containing your php-cgi.exe file. For the purposes of this guide, the path is C:\PHP.
The most important field on the tab is the Parameters. The Parameters define the initial setup of your server. Here’s the full parameter list you should have:
- "-b” loads the following arguements before PHP is started.
- “127.0.0.1:9123” tells PHP that it is running on the localhost and using the port 9123.
Now click on the Settings tab. If you DON'T want to see PHP running, uncheck the Interact with Desktop check box & select “Hidden” from the “Show Window” dropdown. You can optionally run PHP as the user you installed it as. In the Logon Account field type your username (e.g. Administrator) and then enter the user's password twice in the Password and Confirm fields. You can also change the Process Priority to allocate more CPU time to PHP or specify which CPU or core PHP will run on (in the case of multi-processor, hyperthreaded or multi-core CPUs).
Now click on the Lifecycle tab. Uncheck Graceful Shutdown as PHP doesn't respond to it.
Now click on the OK button to finish setup and start PHP!