Home  >  Article  >  Backend Development  >  Explain the establishment of PHP7 operating environment under Windows 7

Explain the establishment of PHP7 operating environment under Windows 7

coldplay.xixi
coldplay.xixiforward
2021-03-08 09:23:272636browse

Explain the establishment of PHP7 operating environment under Windows 7

php7 claims to be able to catch up with Facebook's HHVM. In order to experience the legendary high performance, I specially tried it on my local computer. After installing php7, I have to admit that the running environment of php7 is still a bit harsh compared to the previous php5. Let’s start with the topic.

## Recommended (free): PHP7

1. Environment preparation

1. windows7 version requirements

If you are using win7 system, you must make sure that the SP1 update package is installed on your system. This is definitely the Necessary conditions, as shown in the figure:

##2. To download php7

## you need to download the thread-safe version of php7, otherwise , we will not be able to load the php7apache2_4.dll extension, download address:

##http://php.net/downloads.php

##3. Download Apache2.4

For compatibility reasons, we chose the Apache version under the VC9 compilation environment, download address:

##http://httpd.apache.org/download.cgi

The download process is as follows:




#Note: Apache2.2 does not support php7, so we must download Apache2.4

#4. Download Visual C 2015

##Since php7 uses the VC14 compilation environment, we also need to download Visual C 2015. Download address:

https://www.microsoft.com/en-US/download/details.aspx?id=48145

##2. Start the installation

## 1. Double-click to install vc_redist.x64.exe

2. Unzip php-7.0.10-Win32-VC14-x64.zip, The directory structure is as follows:

##3. Unzip httpd-2.4.23-x64.zip, the directory structure is as follows:

##4. Create Apache service

Enter the cmd command line and enter:

"D:\program\myplatform\Apache2.4\bin\httpd.exe" -k install -n Apache2.4, as shown in the figure:

superior The picture indicates that the permissions are not enough. We execute it again with administrator rights, as shown in the picture:


The above picture indicates that the Apache2.4 system service has been successfully created.

##3. Configure Apache

File to be modified: D:/program/myplatform/Apache2.4/conf/httpd.conf

1. Set the installation directory of apache

##Change Define SRVROOT "/Apache24" is changed to

##Define SRVROOT "D:/program/myplatform/Apache2.4"

2. Configure the workspace

Change the following two lines

##DocumentRoot "${SRVROOT}/htdocs"

##changed to

DocumentRoot "D:/javapro"

#3. Load php module

##At the end of the tag, add the following three lines:

PHPIniDir "../PHP/php-7.0.10"

##LoadModule php7_module "../PHP/php-7.0.10/php7apache2_4.dll"

##AddType application/x-httpd-php . php

Note: The relative path is used here, and the root directory of the relative path is the value of the ServerRoot parameter, also It is the value defined previously by SRVROOT, not the directory where the httpd.conf configuration file is located.

##4. Access to the website directory is prohibited

For security reasons, we'd better configure this option to prohibit access to the website's directory list. As follows:

##In the tag, replace

Options Indexes FollowSymLinks

##Changed to

Options None

##5. Configure the default home page

##Inside the tag, replace

DirectoryIndex index.html

## is modified to

DirectoryIndex index.html index.php

##four , configure php

# Files that need to be modified: D:/ program/myplatform/php-7.0.10/php.ini

##1. Modify php .ini-development

# willD:/program/myplatform/## The php.ini-development file name in the #php-7.0.10 directory is changed to php.ini

2. Modify the extension directory

## extension_dir = "D:/program/myplatform/PHP/php-7.0.10/ext"

## This must be an absolute path

##3. Turn on related extensions

Enable relevant extensions as needed. I only enabled the following extensions here:

extension=php_gd2.dll

# #extension=php_curl.dll

##extension=php_mbstring.dll

##extension=php_openssl.dll

##extension=php_mysqli.dll

##extension=php_pdo_mysql.dll

Note: In php7, the php_mysql.dll extension is no longer supported.

4. Set time zone

date.timezone ="Asia/Shanghai"

##5. Set error reporting level

##error_reporting = E_ALL ^ ​​E_NOTICE

##5. Check the Apache configuration

Switch to the bin directory of the apache installation directory and enter: httpd.exe -t , as shown in the picture:

##If Syntax OK is returned, it means that the configuration of apache and the required operating environment are OK. If not, you need to troubleshoot the error according to the error message. .

##6. Test Apache,php is working normally

In the root directory of the workspace, create a new index.php with the following content:

phpinfo();

##Then, start the Apache service, as shown in the figure:

##Open browse Server, enter: http://localhost:8081. If you see the following interface, it means that the running environment configuration is successful!

#More free recommendations:

PHP7 tutorial

The above is the detailed content of Explain the establishment of PHP7 operating environment under Windows 7. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete