当前位置:网站首页>Apache+php+mysql environment construction is super detailed!!!

Apache+php+mysql environment construction is super detailed!!!

2022-06-24 19:42:00 Game programming

Preface : Studying recently PHP Language , Sort out the part about environment construction , You can also choose an integrated environment, which will be more convenient , Setting up your own environment will help you better understand the principle , Suitable for beginners , It will be updated continuously ~~~
Determine the location of the server VC edition ( Be sure to look at it. , Avoid the following mistakes )
Version inconsistencies can lead to Apache In the load php Error in package , like this :

Apache+PHP+MySQL Environment construction is super detailed !!! - The first 17 Zhang

Determine the server VC Steps for version :

1. View the server's... In the control panel VC edition .

Apache+PHP+MySQL Environment construction is super detailed !!! - The first 18 Zhang

Apache+PHP+MySQL Environment construction is super detailed !!! - The first 1 Zhang

Installation configuration Apache

Be careful :Apache Unable to resolve php file , Need to install php

download

obtain Apache Compressed package , Select the version that matches your server to download , Just unzip .( Official website :https://www.apachehaus.com

Apache+PHP+MySQL Environment construction is super detailed !!! - The first 19 Zhang

Directory description

Apache+PHP+MySQL Environment construction is super detailed !!! - The first 20 Zhang

bin Catalog :

Apache+PHP+MySQL Environment construction is super detailed !!! - The first 21 Zhang

To configure

1. stay httpd.conf Find Define SRVROOT. Change to Apache Storage directory ( Here is :C:\SERVER\Apache24)

Apache+PHP+MySQL Environment construction is super detailed !!! - The first 22 Zhang

2. install Apache The main service of httpd.exe( It is a process running independently in the background , With it ,Apache To start ), It has been downloaded here , Therefore, the prompt has been downloaded .

Apache+PHP+MySQL Environment construction is super detailed !!! - The first 23 Zhang

3. Found in the installation directory ApacheMonitor.exe Double click start up , An icon appears in the lower right corner (C:\SERVER\Apache24\bin)

Apache+PHP+MySQL Environment construction is super detailed !!! - The first 24 Zhang

4. Test whether the configuration is successful : View modules used ( Get into bin Catalog , Use command :httpd.exe -M)

Apache+PHP+MySQL Environment construction is super detailed !!! - The first 2 Zhang

Installation configuration PHP

download PHP Language

  1. obtain PHP The installation files ( Official website )
    Apache+PHP+MySQL Environment construction is super detailed !!! - The first 3 Zhang
    Apache+PHP+MySQL Environment construction is super detailed !!! - The first 4 Zhang

    Here, be sure to download the second version , Otherwise there may not be apache Support package !!!

    Apache+PHP+MySQL Environment construction is super detailed !!! - The first 5 Zhang
    Apache+PHP+MySQL Environment construction is super detailed !!! - The first 6 Zhang

    2. Unzip and rename

    Apache+PHP+MySQL Environment construction is super detailed !!! - The first 7 Zhang

Directory description

Apache+PHP+MySQL Environment construction is super detailed !!! - The first 25 Zhang

php.exe Application

php.exe ==> take php The code turns into HTML Code , So that the browser can parse .

  1. stay apache master station (C:\Apache\Apache24\htdocs) Write a php Code ,index.php.
    Apache+PHP+MySQL Environment construction is super detailed !!! - The first 8 Zhang

    2、 adopt cmd The controller enters php.exe In the directory ( Here is Apache/php-7.0.2)
    adopt php.exe Run the command to specify the php Script :php.exe -f php File path , It can be executed PHP Code , Output hello world.

    Apache+PHP+MySQL Environment construction is super detailed !!! - The first 9 Zhang

To configure Apache load PHP modular

Be careful : After configuration ,PHP If the configuration file is modified, it must be restarted Apache Will take effect !!!
principle :

  1. Apache Assign work to PHP modular , If it is PHP The code is left to PHP Handle : File suffix judgment .php The end must be PHP Code .

  2. take PHP Load the configuration file of into Apache In profile : Take effect together . step :
    1. stay Apache It is specified in PHP The path of the configuration file , stay Apache Primary profile for (C:\SERVER\Apache24\conf\httpd.conf) Load in PHP Module provided (C:\SERVER\php-7.0.2\php5apache2_2.dll).

    Apache+PHP+MySQL Environment construction is super detailed !!! - The first 10 Zhang

    2. Verify that the load was successful , Get into C:\SERVER\Apache25\bin Execute... In the path httpd.exe -M( Note here M Capitalization )

    Apache+PHP+MySQL Environment construction is super detailed !!! - The first 11 Zhang

    3.Apache Assign work to PHP modular , If it is PHP The code is left to PHP Handle , File suffix judgment .php The end must be PHP Code .

    Apache+PHP+MySQL Environment construction is super detailed !!! - The first 12 Zhang

    4. Check if the configuration is successful , Use httpd.exe -t Check the syntax for errors . notice OK That's all right. .

    Apache+PHP+MySQL Environment construction is super detailed !!! - The first 13 Zhang

    5. take PHP The configuration file is loaded into the Apache In profile , Take effect together .(3.1 PHPIniDir php.ini Location path )

    Apache+PHP+MySQL Environment construction is super detailed !!! - The first 14 Zhang
    1. 3.2 php.ini The file does not exist by default , In order to development and production Format exists , Need to format .( It is recommended to make a copy and modify the suffix )
    Apache+PHP+MySQL Environment construction is super detailed !!! - The first 15 Zhang

    7. Test success : Write a php file .

    Apache+PHP+MySQL Environment construction is super detailed !!! - The first 16 Zhang

Installation and configuration MySQL

install MySQL Software

1. Download the installation package from the official website , Double click to install

Apache+PHP+MySQL Environment construction is super detailed !!! - The first 26 Zhang

2. Agree to proceed to the next step .

Apache+PHP+MySQL Environment construction is super detailed !!! - The first 27 Zhang

3. Choose the installation type , Custom installation , Select the installation directory ( Software installation directory and data installation directory ).
For the convenience of management :
Software installation directory :SERVER\mysql
Data installation directory :SERVER\mysql\data

Apache+PHP+MySQL Environment construction is super detailed !!! - The first 28 Zhang
Apache+PHP+MySQL Environment construction is super detailed !!! - The first 29 Zhang
Apache+PHP+MySQL Environment construction is super detailed !!! - The first 30 Zhang

4. After the installation, the configuration is realized .

Apache+PHP+MySQL Environment construction is super detailed !!! - The first 31 Zhang

5. Select detailed configuration

Apache+PHP+MySQL Environment construction is super detailed !!! - The first 32 Zhang

6. Selection environment

Apache+PHP+MySQL Environment construction is super detailed !!! - The first 33 Zhang

7. Select function ( Default )

Apache+PHP+MySQL Environment construction is super detailed !!! - The first 34 Zhang

8. Concurrent mode selection ( Default )

Apache+PHP+MySQL Environment construction is super detailed !!! - The first 35 Zhang

9. Select access mode

Apache+PHP+MySQL Environment construction is super detailed !!! - The first 36 Zhang

10. Choose character set

Apache+PHP+MySQL Environment construction is super detailed !!! - The first 37 Zhang

11. Service installation , Set up MySQL Self starting

Apache+PHP+MySQL Environment construction is super detailed !!! - The first 38 Zhang

12. Input root( Super administrator ) The user password of .

Apache+PHP+MySQL Environment construction is super detailed !!! - The first 39 Zhang

13. Waiting for configuration : All four are successful only if they are ticked .

Apache+PHP+MySQL Environment construction is super detailed !!! - The first 40 Zhang

Directory description

Apache+PHP+MySQL Environment construction is super detailed !!! - The first 41 Zhang

bin Catalog

Apache+PHP+MySQL Environment construction is super detailed !!! - The first 42 Zhang

Software design structure :C/S and B/S:
C/S:Clint client /Server Server side , Users need to install client products to access the server , And can only access one kind of software ( At present, I am ).
B/S:Browser browser /Server Server side , Users only need to install the browser , You can access all servers (B/S Architecture Services ).

Access Process

MySQL Is a C/S Architecture software , You need to access the server through the client (MySQL It also provides access to other modes : Act as a client through some plug-in extensions ).
Sign in :
MySQL The client access server needs to find a match ; Connection authentication connection :IP And port confirmation , If it is local, you can omit .
-h The host address ---> -hlocalhost( It can be IP)
-p port ---> -p3306
authentication : Enter the server through user name and password
-u user name ---> -uroot Don't omit ( Except anonymous users )
-p password ---> -proot

To configure PHP load MySQL Expand

PHP It does not have the ability to operate MySQL Database capabilities , Need help PHP operation MySQL The extended implementation of .
1.PHP load MySQL Expand (apache Need to restart );php.ini In file :

Apache+PHP+MySQL Environment construction is super detailed !!! - The first 43 Zhang

2. Check if the configuration is successful , adopt phpinfo Interface to judge .

Apache+PHP+MySQL Environment construction is super detailed !!! - The first 44 Zhang
Apache+PHP+MySQL Environment construction is super detailed !!! - The first 45 Zhang

Only MySQLIND, Description: the configuration was not successful .

Apache+PHP+MySQL Environment construction is super detailed !!! - The first 46 Zhang

2.PHP All extensions are ext In the folder , You need to specify the path where the extension is located :extension_dir

Apache+PHP+MySQL Environment construction is super detailed !!! - The first 47 Zhang

(php.ini Has been apache load , So it needs to be restarted to take effect )
## By calling phpinfo(), See if the configuration is successful .

Set up PHP System time zone

adopt php.ini Medium timezone Configuration to realize .( Need to restart apache)
###PRC It means time zone of China

Apache+PHP+MySQL Environment construction is super detailed !!! - The first 48 Zhang

author :GuJingnan~

Game programming , A game development favorite ~

If the picture is not displayed for a long time , Please use Chrome Kernel browser .

原网站

版权声明
本文为[Game programming]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/175/202206241330118731.html