PHP Development Environment Build: Apache + php + MySQL
1. Download the apache,php and MySQL installation package
2. Install Apache: Download Apache if the. msi can be directly double-clicked, follow the instructions step-by-step installation: (if the operating system is WIN8, you cannot install the. msi by double-clicking, you need to run CMD as an administrator and enter the. msi installation package in CMD.)
directory, and then run the. msi file to install)
If the package is compressed, then run cmd as an administrator, in CMD into the directory after Apache decompression, into the bin subdirectory, find Httpd.exe, in the cmd input httpd-k install, you can
Install Apache services.
3. Install php:php download down general is compressed package, decompression can, no installation
4. Install MySQL: with Apache. msi installation, step by step installation
5. Configuration: After successful installation, the three are still independent of each other, there is no relationship, need to be configured accordingly.
5.1 To run the written PHP Web script is to make a request to the Apache server, but Apache itself does not parse the PHP script, so you need to configure Apache, so that it can invoke the PHP engine to parse the PHP script, the operation is as follows:
1) Configure PHP as Apache module in apache/conf/httpd.conf file: LoadModule php5_module E:/software/php/php5apache2_4.dll, The actual path and file name will vary depending on the location of the decompression and the PHP version.
This dynamic link library file is usually in the root directory after PHP decompression
2) in the apache/conf/httpd.conf file, set Apache to transfer the. php file request to the PHP module: AddType application/x-httpd-php. php
3) Add the path to the PHP config file php.ini in the apache/conf/httpd.conf file: Phpinidir e:/software/php (Note: The root directory after PHP decompression will be
Php.ini-development and php.ini-production Two default profiles, a copy of Php.ini-development is renamed to php.ini in the development environment)
The MySQL database may need to be connected in a 5.2php script, but PHP itself is not connected to MySQL and needs to be configured accordingly:
1) Open MySQL extension in php.ini, extension=php_mysql.dll delete the preceding semicolon. In the future the actual development may also open other extensions such as PDO,CURL,GD, etc.
2) in php.ini, inform the PHP extension DLL where the path: Extension_dir = "E:/software/php/ext", the actual path varies depending on the installation location, generally in the PHP root directory of the EXT subdirectory
The above configuration can be completed apache,php and MySQL association.
Note: After the httpd.conf file is modified, it will need to restart Apache to take effect
PHP Learning Note Development environment construction: APACHE+PHP+MYSQL