Install and Configure PHP. 10 minutes to read. Contributors.
In this article by Tali Smith Introduction The fastest and easiest way to install PHP on Internet Information Services (IIS) is by using the Microsoft® Web Platform Installer (Web PI). Web PI completely automates setting up IIS, FastCGI, and the latest version of PHP from the php.net Web site. With Web PI, you can navigate to the 'Web Platform' tab and select 'PHP' under 'Framework and Runtimes' customize link. Alternately, use the instructions that follow as guidance for installing PHP with Windows® Installer or using a compressed (Zip) file installation.
There are two builds for each PHP version: one is thread-safe, and one is not (referred to as the non-thread-safe NTS version). The thread-safe version is designed for environments where the Web server core can keep the PHP engine in memory, running multiple treads of execution for different Web requests simultaneously. The architecture of IIS and the FastCGI extension provide an isolation model that keeps requests separate, removing the need for a thread-safe version. The NTS version does not have any of the code that allows PHP to manage multiple threads. As a result, there is a performance improvement on IIS when using the NTS version when compared to the tread-safe version because the NTS version avoids unnecessary thread-safety checks (FastCGI ensures a single-threaded execution environment). Install PHP There are two main ways to install PHP on a Windows®-based computer: download the Windows Installer or use the Windows Zip file from the.
Either method will get PHP working, but both have some extra steps that are needed to make PHP work well. Windows Installer The Windows Installer version can get a complete PHP environment up and running, but the installation of extensions can be confusing. By default, no extensions are installed, and this can adversely affect the usefulness of the PHP installation. Alternately, all of the extensions can be installed; this results in an unstable system because some of the extensions can conflict with others. It is generally easier to use the Zip file installation. Zip File Installation To use the Zip file installation, follow the instructions in.
The Zip file installation installs many of the extensions that are available for the Windows Installer version; however, none of the extensions are enabled until their entries in the Php.ini file are set up. Download the with binaries of PHP. Under Windows Binaries, click on the most current PHP non-thread-safe Zip package to download the PHP files. Unpack the files to a directory of your choice (for example, C: PHP) on your IIS server.
Rename the Php.ini-recommended to php.ini. Open the Php.ini file in a text editor, then uncomment and modify settings as follows:. Set fastcgi.impersonate = 1.
FastCGI under IIS supports the ability to impersonate security tokens of the calling client. This allows IIS to define the security context that the request runs under. Set cgi.fixpathinfo = 0 The cgi.fixpathinfo provides PATHINFO/PATHTRANSLATED support for Common Gateway Interface (CGI). Setting this to 1 will cause PHP CGI to fix its paths to conform to the specification. Set cgi.forceredirect = 0.
Set openbasedir to point to a folder or network path where the content of the Web site(s) is located. Set extensiondir to point to a location where PHP extensions reside. For PHP 5.2.X, this is typically extensiondir = './ext'. Set errorlog='C:phperrors.log' This can help with troubleshooting. Enable the required PHP extension by un-commenting corresponding lines. More information follows in the section,. Figure 1 Windows extensions.
Click on Start, Settings, Control Panel, and then double-click on the System icon (using the class view). Click on the Advanced system settings link in the left column. From the System Properties window, click on the Advanced tab, and then click on the Environment Variables button at the bottom.
Select the Path variable from the System Variables section, and then click on Edit. Add: c: php to your system path. Figure 2: Edit System Variable. Click OK until you have exited the System Properties window. Start IIS Manager by clicking on Start, Programs, Administrative Tools, and then Internet Information Services (IIS) Manager.
From the IIS Manager, click on the hostname of your server in the Connections panel on the left. Double-click on the Handler Mappings icon. Figure 3: Internet Information Services (IIS) Manager. From the Handler Mappings Actions panel, click on Add Module Mapping.
Figure 4: Handler Mappings. Type the following information into the appropriate text boxes, and then click OK. Request path:.php. Module: FastCGImodule. Executable: C: php php-cgi.exe. Name: FastCGI Figure 5: Add Script Map. Click OK, and then c lick Yes.
In the left panel, click on your server's hostname, and then double-click on the Default Document icon. From the Actions panel on the right, click Add.
Configuring Php 5.2.3 With Gd Support For Mac Os X
Enter index.php as the new default document name, and then click OK. Enter default.php as the new default document name, and then click OK. In the left panel, click on your server's hostname. 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:.
You should now see the PHP information page at. Figure 6: PHP information page Extensions It is important to determine which extensions are needed by the applications that will be running and then to limit the installed extensions to only those. For a typical open-source application installation, for example, the following extensions are installed:. Database Extensions — Most open-source applications that use MySQL for a database engine use either the phpmysql or the phpmysqli extensions. For new development work, either of these extensions work well, or consider using the PDO versions of the MySQL driver (PDO is a PHP extension providing a data-access abstraction layer that can be used with a variety of databases); this extra layer of abstraction provides a richer set of object database functionality and controls.
If Microsoft® SQL Server® (or an express version, such as Microsoft® SQL Server® 2008 Express or Microsoft® SQL Server® 2005 Express Edition) is the database engine, use the phpmssql extension for open-source applications. For new development work, use the PDO version of the SQL driver.
Image Handling Extensions — Many of the open-source applications that enable work with images make use of the GD2 extension – phpgd2, which has a number of good basic image manipulation application programming interfaces (APIs). Some applications use the. There is also a phpexif library for working with the extended information that modern digital cameras store within the images. Internationalization and Localization Extensions &mdash- The two most commonly used extensions for i18n and l10n are phpmbstring (Multi-Byte String) and phpgettext (Native Language Support).
Many of the open-source applications use one or both of these. Web Services Extensions — Choose the Web services extensions based on the services desired.
Configuring Php 5.2.3 With Gd Support For Mac
For PHP, the SOAP extension is widely used. The XML-RPC extension is often used in conjunction with SOAP and other services. PHP.INI File Settings The Php.ini file provides PHP with configuration and environmental information. Below are a number of settings for the Php.ini file that help PHP work better with Windows. Required Settings. extensiondir = The extensiondir needs to point to the directory where the PHP extensions are stored.
The path can be fully qualified (for example, C: PHP ext) or relative (for example,. Extensions that are specified lower in the Php.ini file need to be located in the extensiondir. If the extensions specified are not in the extensiondir, then PHP will give a warning message at the start of script execution, and the application may show errors because of the missing functionality.
extension = xxxxxx.dll For each extension enabled, a corresponding extension= directive that tells PHP which extensions in the extensiondir to load at startup time is necessary. logerrors=On PHP errors can also go through the PHP error logging facility. This can be used to send errors to a file or to a service (for example, syslog) and works with the errorlogdirective described below. When running under IIS, logerrors must be enabled with a valid errorlog. Otherwise, FastCGI considers any startup messages (which may be benign) as an error condition, which generates an HTTP 500 return error code to the browser. errorlog=.
Save and close the file. Start Internet Explorer, and navigate to Figure 9: Using session state. Observe that the counter is 1. Request again, or press F5. Figure 10: Using session state. Observe that the counter is 2.
Code: Fatal error: Call to undefined function imagewebpAfter searching about the error I find the problem. I need to install GD -with-vpx-dir=DIR as I see in PHP.net: I know EasyApache will search for additional GD feature libraries ( ):. JPEG support if find libjpeg.so.
PNG support if find libpng.so. XPM support if find libXpm.so But what about WebP? Is this something like this:. WebP support if find libvpx.so I installed libvpx & libvpx-devel and after that I find libvpx.so as same path as libXpm.so and other.so than I rebuild EasyApache and I expected see -with-vpx-dir=DIR in my phpinfo configure command section, but nothing different and if I use imagewebp got the error. Where am I wrong? And how to enable imagewebp on my server (CentOS 7 - 64bit).