Difference between revisions of "Installing PHP On Windows"

From ISoft Wiki
Jump to navigationJump to search
(Create the basic installation documentation for PHP on Windows)
 
(→‎Installing PHP: Added a warning about Window's VirtualStore)
Line 18: Line 18:
   Uncomment the line that says 'extension_dir = "ext"'
   Uncomment the line that says 'extension_dir = "ext"'
   Uncomment the line that says 'extension=php_mysqli.dll'
   Uncomment the line that says 'extension=php_mysqli.dll'
'''Note:''' If php.ini seems to up and disappear, this is because Windows has moved it to the user's application store: C:\Users\<username>\AppData\Local\VirtualStore\Program Files (x86)\PHP  You can edit it in that location, and when PHP is run under this user, it'll act as though the ini file is in the directory.  To make php.ini valid for all users, once the changes have been made to php.ini, copy it from the VirtualStore to C:\Program Files (x86)\PHP.


7. Verify the configuration by running <pre>php -r phpinfo(); > phpinfo.rtf</pre> If this doesn't work, make sure that PHP is in the path.
7. Verify the configuration by running <pre>php -r phpinfo(); > phpinfo.rtf</pre> If this doesn't work, make sure that PHP is in the path.

Revision as of 17:17, 4 March 2014

Some scripts and services that we can provide are written in PHP. To roll them out to customers, we need to install PHP on their servers. This is generally already done or easily done on Linux servers, but is more difficult for Windows servers. This document gives a quick walkthrough of the installation process.

Installing PHP

For maximum compatibility, the PHP install provided is compiled for 32-bit, but will work just fine on 64-bit systems.

1. Download the PHP package from dl.isoftdata.com: http://dl.isoftdata.com/php-5.5.9-windows.zip

2. Unzip the top level zip file and run vcredist_x86.exe. This installs the Visual C++ for Visual Studio 2012 redistributable necessary for PHP.

3. Unzip the php-5.5.9-Win32-VC11-x86.zip zip file into C:\Program Files(x86)\PHP

4. Open up the System Properties. Under the "Advanced" tab, click "Environmental Variables". Pick the "Path" from the list in the "System variables" box. Click the "Edit..." button. Type ";C:\Program Files(x86)\PHP" into the box to add the PHP to the path. Click all the OKs.

5. Rename C:\Program Files (x86)\PHP\php.ini-release to C:\Program Files (x86)\PHP\php.ini

6. Edit that php.ini file:

 Uncomment (remove the semicolon at the start of the line) date.timezone= and set it to the valid timezone.  ISoft is 'date.timezone=America/Chicago'
 Uncomment the line that says 'extension_dir = "ext"'
 Uncomment the line that says 'extension=php_mysqli.dll'

Note: If php.ini seems to up and disappear, this is because Windows has moved it to the user's application store: C:\Users\<username>\AppData\Local\VirtualStore\Program Files (x86)\PHP You can edit it in that location, and when PHP is run under this user, it'll act as though the ini file is in the directory. To make php.ini valid for all users, once the changes have been made to php.ini, copy it from the VirtualStore to C:\Program Files (x86)\PHP.

7. Verify the configuration by running

php -r phpinfo(); > phpinfo.rtf

If this doesn't work, make sure that PHP is in the path.

8. Open phpinfo.rtf in WordPad, and make sure there is a mysqli section. If there isn't a mysqli section, check to see that "Loaded Configuration File" near the beginning of the file is "C:\Program Files (x86)\PHP\php.ini"

The php.ini file can be customized for the site or any script needs. The date.timezone change is strongly recommended, as PHP will constantly complain unless it is set. The mysqli change is required for most of our modern scripts, and is recommended regardless.

If the php.ini file is changed, running PHP processes will need to be restarted to catch those changes. That means restarting any Apache, IIS, or FastCGI instances on the server. If only standalone scripts are used, there is no running process to restart.