Home > Backend Development > PHP7 > Building PHP7 operating environment under Windows 7

Building PHP7 operating environment under Windows 7

coldplay.xixi
Release: 2023-02-17 19:30:02
forward
2265 people have browsed it

Building PHP7 operating environment under Windows 7

Recommended (free): PHP7

php7 is known as HHVM can catch up with Facebook. In order to experience the legendary high performance, I deliberately tried to install php7 on my local computer. I have to admit that the operating environment of php7 is still a bit harsh compared to the previous php5. Let’s start with the topic.

1. Environment preparation

1. windows7 version requirements

If you are using win7 system, you must make sure The SP1 update package is installed on your system. This is absolutely necessary, as shown in the figure:

#2. 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 Apache version under 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 have to 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:

##The above picture represents permissions If it is not enough, we execute it again with administrator rights, as shown in the figure:


#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: relative paths are used here , the root directory of the relative path is the value of the ServerRoot parameter, which 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. Open related extensions

Enable relevant extensions as needed. I only have the following extensions enabled 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: php_mysql is no longer supported in php7 .dll is extended.

4. Set time zone

date.timezone ="Asia/Shanghai"

##5. Set error reporting level

##error_reporting = E_ALL ^ ​​E_NOTICE

##5. Check 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 whether Apache and php are working properly

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

phpinfo();
Copy after login

##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!

##

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

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template