Install Config Wiki

All about installing, configuring and troubleshooting

User Tools

Site Tools


wiki:install_and_configure_php_7.0.26_on_windows_server

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
wiki:install_and_configure_php_7.0.26_on_windows_server [2018/01/02 13:57] – [Install the Visual C++ Redistributable for Visual Studio 2015] wikiadminwiki:install_and_configure_php_7.0.26_on_windows_server [2022/10/29 17:28] – [Configure the php.ini File] wikiadmin
Line 1: Line 1:
 ======Install and Configure PHP 7.0.26 On Windows Server====== ======Install and Configure PHP 7.0.26 On Windows Server======
- +====Obtain the PHP Binaries for Your Windows Operating System and the Visual C++ Redistributables for Visual Studio==== 
-  -Go to [[http://windows.php.net/download]] +  -Go to [[http://windows.php.net/download]] to find and download the appropriate PHP binaries and the corresponding Visual Studio Visual C++ Redistributable. 
-  -If you are planning to use FastCGI support in IIS, then you should download a Non-Thread-Safe version of PHP. Note that the architecture of IIS and the FastCGI extension provide an isolation model that keeps requests separate, removing the need for a thread-safe version.+  -If you are planning to use FastCGI support in IIS, which you should for performance purposes, then you should download a Non-Thread-Safe version of PHP. Note that the architecture of IIS and the FastCGI extension provide an isolation model that keeps requests separate, removing the need for a thread-safe version.
   -If your Windows Server has a 32 bit operating system, then download the Zip file for VC14 x86 Non-Thread Safe   -If your Windows Server has a 32 bit operating system, then download the Zip file for VC14 x86 Non-Thread Safe
   -If your Windows Server has a 64 bit operating system, then download the Zip file for VC14 x64 Non-Thread Safe   -If your Windows Server has a 64 bit operating system, then download the Zip file for VC14 x64 Non-Thread Safe
Line 10: Line 10:
   -Click "Extract" button and/or Click "Next" button (to proceed with extracting)   -Click "Extract" button and/or Click "Next" button (to proceed with extracting)
   -After extracting, view the root of the extracted files in Windows Explorer.  They should be located in the php-7.0.26-nts-win32-VC15-x86 sub-folder. Remember this location for later. You can use a text editor like Notepad++ to view the "Install.txt" file.   -After extracting, view the root of the extracted files in Windows Explorer.  They should be located in the php-7.0.26-nts-win32-VC15-x86 sub-folder. Remember this location for later. You can use a text editor like Notepad++ to view the "Install.txt" file.
 +**Caution - 500 Errors with Newer PHP Builds:**  Trying to install PHP 7.2 on either Server 2008 SP2 or Server 2008 R2 requires the use of the VC15 Binaries and the corresponding Visual C++ Redistributable for Visual Studio 2017 (rather than Visual Studio 2015). One or both of these, that is either the PHP 7.2.x build or the C++ Redistributable for Visual Studio 2017, seem to be incompatible with IIS7 and/or those older operating systems. When testing the install of PHP 7.2.0 VC15 with the C++ Redistributable for Visual Studio 2017, the IIS 7 displays a 500 Error - Internal Server Error crashing the FastCGI Module.   Also on those 2008 operating systems, you may want to avoid PHP 7.1.x as well, even though PHP 7.1.x build uses a VC14 download that corresponds to using Visual C++ Redistributable for Visual Studio 2015 (rather than 2017).  500 Errors may result using the 7.1 Binaries. 
  
 ====Enable FastCGI Role Service for IIS7====   ====Enable FastCGI Role Service for IIS7====  
   -Make sure that you have enabled FastCGI support for IIS7. This is the URL for the source article containing the following listed instructions: [[https://docs.microsoft.com/en-us/iis/application-frameworks/install-and-configure-php-on-iis/enable-fastcgi-support-in-iis-7-on-windows-server-2008-windows-server-2008-r2-windows-vista-or-windows-7]]   -Make sure that you have enabled FastCGI support for IIS7. This is the URL for the source article containing the following listed instructions: [[https://docs.microsoft.com/en-us/iis/application-frameworks/install-and-configure-php-on-iis/enable-fastcgi-support-in-iis-7-on-windows-server-2008-windows-server-2008-r2-windows-vista-or-windows-7]]
-  -Open the "Server Manager" and, in the left pane, select the icon for "Roles" (but do not +expand roles)+  -**Note on Prerequisites**: If you are enabling FastCGI on Server 2008, you may need to download and install the FastCGI Update for IIS 7 for Windows Server 2008 (KB954946) from here: [[http://go.microsoft.com/fwlink/?LinkId=131593]].  This will provide an extra icon for FastCGI Settings in the IIS 7 Management Console.  This FastCGI Settings module is in addition to the existing Handler Mappings module. 
 +  -**Note2 on Prerequisites**: You may also need or want to install Microsoft IIS 7 Administration Pack 1.0 (x86) on Server 2008 SP2 (x86) from here: [[http://go.microsoft.com/?linkid=9655656]] - (File Name: AdminPack_x86.msi). When you attempt installation using this *.msi file, an alert box may tell you whether this Package is not suitable for your operating system. 
 +  -__Begin Instructions to Enable FastCGI Role Service__.  **First**, Open the "Server Manager" and, in the left pane, select the icon for "Roles" (but do not +expand roles)
   -In the right pane, under Windows Server (IIS), look under the subcategory of Role Services, and click the link on the far right to "Add Role Services"   -In the right pane, under Windows Server (IIS), look under the subcategory of Role Services, and click the link on the far right to "Add Role Services"
   -Under Application Development category, select the checkbox next to "CGI" for installing the "CGI" role service.  This enables both the CGI and the FastCGI services.   -Under Application Development category, select the checkbox next to "CGI" for installing the "CGI" role service.  This enables both the CGI and the FastCGI services.
Line 21: Line 24:
   -Click the "Close" button   -Click the "Close" button
 ====Install the Visual C++ Redistributable for Visual Studio 2015==== ====Install the Visual C++ Redistributable for Visual Studio 2015====
-  -The "VC14" builds require installation of the Visual C++ Redistributable for Visual Studio 2015 either x64 or x86 depending on whether you are installing the 32bit or 64bit version of PHP on your Windows server.+  -The "VC14" builds require installation of the Visual C++ Redistributable for Visual Studio 2015 either x64 or x86 depending on whether you are installing the 32bit or 64bit builds of PHP on your Windows server.
   -Visual Studio 2015 for X64 (64bit) or for x86 (32bit) may be downloaded here: [[https://www.microsoft.com/en-us/download/details.aspx?id=48145]]   -Visual Studio 2015 for X64 (64bit) or for x86 (32bit) may be downloaded here: [[https://www.microsoft.com/en-us/download/details.aspx?id=48145]]
   -Now install the downloaded Visual Studio 2015 x86 or x64 redistributable by opening or running the file named VC_redist.x86.exe or VC_Resist.x64.exe as the case may require   -Now install the downloaded Visual Studio 2015 x86 or x64 redistributable by opening or running the file named VC_redist.x86.exe or VC_Resist.x64.exe as the case may require
Line 36: Line 39:
   -Set cgi.force_redirect = 0   -Set cgi.force_redirect = 0
   -Set open_basedir = a path pointing to a folder or network path where the content of the Web site(s) is located. (Such as c:\hostdata), or just leave it commented like this ";open_basedir =" without the quotes   -Set open_basedir = a path pointing to a folder or network path where the content of the Web site(s) is located. (Such as c:\hostdata), or just leave it commented like this ";open_basedir =" without the quotes
-  -Set extension_dir to point to a location where PHP extensions reside. This is typically extension_dir = "./ext"+  -Set extension_dir to point to a location where PHP extensions reside. This is typically extension_dir = "./ext" However, per php.ini in PHP8 for "Windows" set it as follows:  extension_dir = "ext"
   -Set error_log="C:php_errors.log"  ;REMARK This can help with troubleshooting.  Alternatively, set **error_log = "c:\php\logs\errors_log"** and make a new sub-folder in c:php named "logs" and grant the sub-folder "logs" full control write access for both IUSR and IIS_USERS.   -Set error_log="C:php_errors.log"  ;REMARK This can help with troubleshooting.  Alternatively, set **error_log = "c:\php\logs\errors_log"** and make a new sub-folder in c:php named "logs" and grant the sub-folder "logs" full control write access for both IUSR and IIS_USERS.
   -Enable the required PHP extension by un-commenting the appropriate lines within the extensions section of the php.ini file.  See a further discussion of which extensions to enable.   -Enable the required PHP extension by un-commenting the appropriate lines within the extensions section of the php.ini file.  See a further discussion of which extensions to enable.
Line 59: Line 62:
   -In the left panel, click on your server's hostname.   -In the left panel, click on your server's hostname.
   -In the Actions panel on the right, click Restart.   -In the Actions panel on the right, click Restart.
-  -Create a new text document, and save it as c:\inetpub\wwwroot\phpinfo.php with the following content: <?php phpinfo(); ?>+====Test Your PHP Installation==== 
 +  -Create a new text document, and save it as c:\inetpub\wwwroot\phpinfo.php with the following content: <file php><?php phpinfo(); ?></file>
   -You can now go to your web browser and see php information at: <file php>http://localhost/phpinfo.php</file>    -You can now go to your web browser and see php information at: <file php>http://localhost/phpinfo.php</file> 
  
  
-If you have Windows Server 2008, and you are receiving 500 errors when you test phpinfo.php from localhost, then you may need to download and install Windows Server 2008 Service Pack 2+If you have Windows Server 2008 without service pack 2 installed, then you may want to download and install Windows Server 2008 Service Pack 2.
 See: [[https://www.microsoft.com/en-us/download/confirmation.aspx?id=16468]] See: [[https://www.microsoft.com/en-us/download/confirmation.aspx?id=16468]]
  
-To be continued+
wiki/install_and_configure_php_7.0.26_on_windows_server.txt · Last modified: 2022/10/29 17:31 by wikiadmin