PHP Learning--1 Building Environment

Source: Internet
Author: User
Tags mysql client

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
    1. 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

    1. Installing the MySQL Database
      And almost the next step.

    2. 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

    1. Load the PHP module in Apache (Run PHP as a module of Apache). /apache/conf/httpd.conf

    2. 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.

    1. 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

    1. Load the PHP configuration file into the Apache configuration file. /apache/conf/httpd.conf

    1. Open the MySQL extension. /php/php.ini

    2. 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

    1. Load the virtual host configuration file first. Apache/conf/httpd.conf

But it generates a warning.

    1. Cleanup warning

    2. Create a virtual host

    3. 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.