Why not use the integrated environment directly and need to install the server software separately?
Integrated environment: Phpstudy,appserve,wamp,xamp, does not need to be installed and configured separately, can be used directly as a dynamic Web server.
Because the integration environment is provided by a third party, there is a certain security risk. So, in a real project, the server-side deployment is configured with a separate installation.
Build the Environment
- Installing Apache
Apache is a B/s structure of software, Apache belongs to the s server
Almost always the next step, note: The installed directory can not have Chinese and space
Verify that the installation was successful: in the browser, enter localhost for access
Installing the MySQL Database
And almost the next step.
Install PHP
PHP is not like Apache and MySQL, there are installation files, can be installed directly. PHP is a folder that needs to be linked to Apache through a configuration file.
Download the PHP installation file
Install: In the server directory, directly placed the extracted PHP folder (the name of the facelift)
Configure Apache: Enable Apache to recognize PHP
Load the PHP module in Apache (Run PHP as a module of Apache). /apache/conf/httpd.conf
Specify in Apache that the PHP file will be given to the PHP module for processing
Configure PHP: Allow PHP to act as a MySQL client to connect to MySQL server
PHP itself does not have the ability to operate MySQL, it needs external expansion to be able. In PHP, a set of MySQL extensions are available to connect to the MySQL server.
- Get the PHP configuration file. In the PHP installation directory, there are two configuration files
Copy the Php.ini-development file and rename it to PHP.ini
- Load the PHP configuration file into the Apache configuration file. /apache/conf/httpd.conf
Open the MySQL extension. /php/php.ini
Specifies the directory where the extension file resides. /php/php.ini
How Apache Works
Many of Apache's functions are loaded through modules, and do not have as many capabilities as they do (function)
Virtual Host Configuration
Apache Virtual host is divided into two types: IP address-based virtual host, domain-based virtual host
Domain-based virtual hosting: Apache differentiates the corresponding website (folder) by domain name
Apache provides multiple locations that can be used to configure virtual hosts, httpd.conf and/extra/httpd_vhost.conf
Once the httpd.conf is configured, it will only take effect if you restart Apache directly
After/extra/httpd_vhost.conf configuration, the corresponding configuration file needs to be loaded under httpd.conf
- Load the virtual host configuration file first. Apache/conf/httpd.conf
But it generates a warning.
Cleanup warning
Create a virtual host
Set access Permissions
Note: Once the virtual host is turned on, the default localhost will be overwritten and overwritten by the first virtual host, in order to solve the problem of not being overwritten, an additional localhost virtual host is added.
PHP Learning--1 Building Environment