Difference between revisions of "Installing PHP On Windows"
Line 9: | Line 9: | ||
# Find the redistributable packages here: | # Find the redistributable packages here: | ||
*32-bit http://windows.php.net/downloads/releases/php-5.6.18-nts-Win32-VC11-x86.zip | *32-bit http://windows.php.net/downloads/releases/php-5.6.18-nts-Win32-VC11-x86.zip | ||
*64-bit: https://www.microsoft.com/en-us/download/details.aspx?id= | *64-bit: https://www.microsoft.com/en-us/download/details.aspx?id=48145 | ||
Revision as of 11:57, 11 April 2016
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. If you want to use 64-bit version of PHP, one is also available. If you use the 64-bit version, you should use C:\Program Files for all instructions, rather than C:\Program Files (x86). Except for the minor filename and directory changes, all other steps are identical.
1. Download the PHP package from dl.isoftdata.com: http://dl.isoftdata.com/php-5.5.9-windows.zip (32-bit) or http://windows.php.net/downloads/releases/php-7.0.5-Win32-VC14-x64.zip (64-bit)
2. Unzip the top level zip file and run either vcredist_x86.exe or vcredist_x64_vs11.exe (depending on if you are using 32-bit or 64-bit). This installs the Visual C++ for Visual Studio 2012 redistributable necessary for PHP.
- Find the redistributable packages here:
- 32-bit http://windows.php.net/downloads/releases/php-5.6.18-nts-Win32-VC11-x86.zip
- 64-bit: https://www.microsoft.com/en-us/download/details.aspx?id=48145
3. Either unzip the php-5.5.9-Win32-VC11-x86.zip zip file into C:\Program Files(x86)\PHP or unzip the php-5.5.12-Win64-VC11-x64.zip file into C:\Program Files\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" (Or ";C:\Program Files\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.