Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build php7.2 Server

2025-01-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "how to build the php7.2 server". In the daily operation, I believe many people have doubts about how to build the php7.2 server. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about how to build the php7.2 server. Next, please follow the editor to study!

Php7.2 server building method: 1, download PHP7.2.9, Apache2.4 and MYSQL5.7 offline package; 2, unzip and rename the downloaded php7.2.9 ZIP file; 3, configure environment variables; 4, restart Apache service.

The operating environment of this paper: Windows7 system, PHP7.2.9, Dell G3.

How to set up the php7.2 server?

Build server with PHP7.2.9+Apache2.4+MYSQL5.7

First we need to download three offline packages, PHP7.2.9 + Apache2.4 + MYSQL5.7

PHP7.2.9:http://www.php.net/ Apache2.4:http://httpd.apache.org/MYSQL5 .7: https: / / dev.mysql.com/downloads/windows/installer/ http://cdn.mysql.com/Downloads/MySQL-5.7/mysql-5.7.23-winx64.msi, this address is directly under the installation package

First, let's talk about how to find the correct available installation package. I find the corresponding installation package according to wampserver. Above is a matching installation package. Go to the official website of http://www.php.net/php and find the version I want. As shown below, click to go to the download page and choose a win-win version to download.

Next, we need to pay special attention to this point. I need to select the 64-bit associative Apache2.4 version of the system (that is, the thread-safe 64-bit installation package in the following figure) and click Zip to download. The reason for choosing the thread-safe version here is that the thread-safe version contains the php7apache2_4.dll file that we need to connect to the Apache.

Then we need to download the installation package of the required Apache2.4 version and enter the http://httpd.apache.org/, as shown below

Also select the window version

Here we download the required package from a third party

Download the 64-bit version

Then find the installation package of the last version of mysql5.7 and enter https://dev.mysql.com/downloads/windows/installer/

Install after download, run

After that, there is an interface to enter the database password in the middle, it is recommended to enter a simple (123456), then change it later, and then the next one is OK, the database password after installation is 123456; of course, you can see the record shown above, download the version from direct http://cdn.mysql.com/Downloads/MySQL-5.7/mysql-5.7.23-winx64.msi, or you can.

Then configure the environment variable so that we can run the mysql command without being in the installation directory. The default installation path is C:\ Program Files\ MySQL\ MySQL Server 5.7.It will be configured in the environment variable. (the MYSQL Server 8.0 environment variable in the picture is wrong and should be changed to MYSQL Server 5.7. Please do not copy the environment variables in the picture below) after the installation is complete, you can go to the console to try to see if your database is installed successfully, the shortcut key WIN + R type cmd, enter enter, enter

# the password is set by you: 123456C:\ Users\ zjy $> mysql-uroot-pEnter password: * Welcome to the MySQL monitor. Commands end with; or\ g.Your MySQL connection id is 12Server version: 5.7.23-log MySQL Community Server (GPL) Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.

All right, the download of the three files and the installation of the database are all over, which is the next key point.

First, configure php7.2.9 (integrate mysql5.7 so that php can use mysql)

Unzip and rename the downloaded ZIP file of php7.2.9

The decompressed content is as follows:

We need to focus on two files, php.ini-development (settings for configuring php) and php7apache2_4.dll (for configuration of Apache load modules)

Here we just need to change the file name of php.ini-development to php.ini so that the php runtime can recognize it.

2. Configure Apache2.4

Unzip the compressed file of Apache 2.4and rename Apache24

After unzipping, copy the Apache24 and php7.2.9 folders to the folder WampSelfDefine we created on disk C, and create a new folder www. Friends who have used wampserver know that this is the directory where the project is stored.

Now you can configure Apache. Enter Apache24 and you can find the httpd.conf file under C:\ WampSelfDefine\ Apache24\ conf.

Edit it, I use subline text as an editing tool, you can use notepad

Remember that it is best to run the tools you use for editing as an administrator to modify this file, which will avoid the lack of permissions and changes that cannot be saved

There are four main points that need to be modified:

1. Path to the modified ServerRoot:

This is the storage path of Apache24, and the variable SRVROOT is used in Apache24, so you only need to change the value of SRVROOT to the path of our Apache24 directory and define SRVROOT "C:\ WampSelfDefine\ Apache24".

two。 Modify the port on which Apache's service listens:

Because the default 80 wide port is likely to be occupied by other computer programs, such as IIS, it is changed to port 8088, and the location using port 80 is also replaced with port 8088. You can use the Ctrl + F key to find 80 and replace it with 8088. In my case, only the server name is used for 80%, so it is replaced with 8088.

Next, you can test whether the above configuration is successful, enter C:\ WampSelfDefine\ Apache24\ bin, copy and change the path, right-click in the start menu to search, type cmd, and run the cmd command prompt as an administrator

A command line window appears, enter cd C:\ WampSelfDefine\ Apache24\ bin, and enter the key

Enter. \ httpd-k install installation service

You can use the shortcut key WIN + R, type service.msc, and enter enter

You can see that Apache24 is running

Enter http:// localhost:8088 in the browser and you can see the following screen

This shows that the configuration of the first two points is successful, and there is no error in the configuration of Apache.

3. Load the php7.2.9 module function:

In order for Apache to parse the php file, we need to configure the relevant information about php in the configuration file, and copy the following configuration information to the LoadModule where the httpd.conf is loaded:

# load PHP module function LoadModule php7_module "C:\ WampSelfDefine\ php7.2.9\ php7apache2_4.dll" # configure the correct path to the php.ini file PHPIniDir "C:\ WampSelfDefine\ php7.2.9" # add a file of type PHP to the Apache server AddType application/x-httpd-php. Php

The location is as shown in the picture

Then you need to modify the DirctoryIndex:

4. Change the directory address of the visited home page to the newly created WWW folder

Save the changes, and then test whether the settings are successful.

We need to create the files index.html and index.php in the www directory

The index.html content is as follows:

This is a custom php+apache service. This is my apache page.

The index.php content is as follows:

Restart the Apache service after saving, right-click the icon below, select Open Monitor, restart the service

Enter the http:// local host in the browser: 8088 / the results are as follows

Enter http:// localhost:8088 / index.php in the browser, and the results are as follows:

Indicates that the configuration is successful.

III. The integration of MySQL and PHP

MySQL is installed and used as an extension of PHP, and we need to modify the path of the php.ini extension class:

Extension_dir = "C:\ WampSelfDefine\ php7.2.9\ ext"

Enable: mysqli and pdo_mysql

Create a mysqli.php and save it under www. The contents are as follows:

Restart Apache and type http://localhost:8088/mysqli.php in the browser

The integration is successful and the configuration is over.

At this point, the study on "how to build a php7.2 server" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 219

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report