Home>Article>Backend Development> Understand the php7+apache2.4 development environment
Recommendation (free):php7
Brief:With the continuous updating of technology, PHP’s status in web pages, backend and other fields It is becoming more and more important; I am a primary school student who has just left school; my major is not software, but I like programming; today I will share with you how to manually configure the php environment under windows and iis; I hope it can help confused partners , if there are any mistakes or good suggestions, let me know; *~*!
1. Software download
2. Installation instructions
3. Apache configuration(The server is IIS , please bypass)
4. iis configuration(The server is apache, please bypass)
5. PHP configuration
6. Additional
1. Software download
##1.1 PHP7
Download PHP7 from the official website, which is divided intoNon Thread SafeandThread Safeversions; the two major versions are adapted to IIS and Apache servers respectively;
1.2 apache2.4
Download apache2.4 from the official website, version number:Apache 2.4.17 Win32;(Note, download version 2.4, you cannot use version 2.2)
1.3 IIS
Windows comes with IIS, just open the installation service; here Not explained one by one;
1.4 vc2015
The operation of PHP7 requires vc2015. Partners who have not installed it can go to http://www.microsoft.com/ zh-cn/download/details.aspx?id=48145Run the installation2. Installation instructions
Take a personal example: store php and apache, etc. The software is stored in the D:\Server directory; Directory organization: D:\Server\php7 D:\Server\apache24 D:\Server\WWW##3. apache configuration
(Open apache24/conf/httpd.conf)
3.1 Directory modification
apache directoryis modified to: ServerRoot "D:/Server/Apache24"
Website storage directoryChanged to: DocumentRoot "D:/Server/WWW/ "
##3.2 PHP settings
Add: (note that the phpIniDir item is above) php7's processing interface for apache
PHPIniDir "D:/Server/Php"
AddType application/x-httpd-php .php .html .htm
LoadModule php7_module "D:/Server/Php/php7apache2_4.dll"##3.2 Service Addition
Cmd command line, enter the d drive, open the directory, run httpd –k install
D:
Cd D:\Server\ Apache24\httpd –k install
httpd –k start
4. iis configuration
Internet Information Services (IIS) Manager, add FastCgi module mapping.
Request path: *.php. Module:FastCGIModule.
Executable file: Select php-cgi.exe under the unzipped package. Name: phpcgi.Note: If there is no fastcgimodule module, add the CGI module in IIS in the program to add and delete windows.
5. PHP configuration (open the php directory, copy php.ini-development and modify it to php.ini)
5.1 ext extension directory path
Open php.ini, find;extension_dir = "D:/Server/Php/ext", and remove the preceding semicolon.
(The extension path must be specified, otherwise php7 cannot be started. Generally, after opening the ext extension directory, you can successfully start php7 on the command line. If it still fails, it means that your php path does not exist. Add it to the environment variables (or your environment variables are used by old php versions))
5.2 Turn on some extensions
Collect personal needs, not explain them one by one;
##5.3 Turn on fastcgi (
For IIS environment)
; fastcgi.impersonate = 0 (remove comment ";"), change 1;
(Starting from PHP5.3, there is no php5isapi.dll in the PHP file, and it cannot be run through the ISAPI extension on IIS6. That is to say, versions after PHP5.3 no longer support the use of ISAPI. The extension is running in IIS and should be configured using the FastCGI method.)
5.4 Open IIS
;cgi. fix_pathinfo=1; (Remove the comment ";")
5.5 Close cgi.force_redirect
; cgi.force_redirect = 1 (uncomment ";"), change 0;
5.6 cgi.rfc2616_headers
; cgi.rfc2616_headers = 0 (remove the comment ";"), change 1;
6. Additional
6.1How to solve the problem when the FastCGI process exits unexpectedly? (For IIS environment)
During the PHP configuration and installation process using Windows7 IIS7, if the PHP configuration is incorrect, the FastCGI process will unexpectedly exit with an error. Information, you can use
php –v
under DOS for debugging and viewing. Under normal circumstances, the error message of the PHP configuration will be reported. As long as it is modified according to this information The relevant PHP configuration is enough.
After configuration, create an info.php in the access directory (WWW) and output the php information to get the following results;
The above is the detailed content of Understand the php7+apache2.4 development environment. For more information, please follow other related articles on the PHP Chinese website!