: This article describes how to configure the runtime environment of php56. For more information about PHP tutorials, see. Required raw materials: (provide links)
- Php-5.6.10-Win32-VC11-x86 (zip) (note that php versions are divided into IIS and Apache versions)
- The httpd-2.4.12-x86-r2 (apache) (zip)
- Mysql database (without installation)
Configuration steps:
Php section
- Decompress the downloaded zip package to obtain the php5.6 folder.
Change php. ini-development in this folder to php. ini as the PHP configuration file.
Modify php. ini
1. set the Directory of the PHP extension package and find
; On windows:
; Extension_dir = "ext"
Change to (the value is the Directory of the ext folder)
; On windows:
Extension_dir = "D:/Develop/PHP/ext"
2. enable the corresponding library function and find the row of the library to be enabled
; Extension = php_curl.dll
; Extension = php_gd2.dll
; Extension = php_mbstring.dll
; Extension = php_mysql.dll
; Extension = php_xmlrpc.dll
Remove the semicolon (comment) and change it
Extension = php_curl.dll
Extension = php_gd2.dll
Extension = php_mbstring.dll
Extension = php_mysql.dll
Extension = php_xmlrpc.dll
3. set the time zone and find
; Date. timezone =
Change
Date. timezone = Asia/Shanghai
Apache section
- Decompress the downloaded Apache zip package to obtain the Apache24 folder.
First, modify the Apache configuration file so that Apache can parse the php file.
The Apache configuration file is httpd. conf in the conf Directory of the Apache Directory.
1. Apache can parse the php file and find it in the configuration file.
# LoadModule vhost_alias_module modules/mod_vhost_alias.so
Add in the next line (the green position depends on the directory where PHP is located)
LoadModule php5_module "D:/Develop/PHP/php5apache2_4.dll"
# Note that the red part may be changed due to different php versions.
PHPIniDir "D:/Develop/PHP"
AddType application/x-httpd-php. php. html. htm
2. find
DirectoryIndex index.html
Change
DirectoryIndex index. php index.html
3. modify the Directory of the Apache site and find it in the configuration file (the directory for Apache installation is different and the displayed value is different)
DocumentRoot "D:/Develop/Apache2.2/htdocs"
Change
DocumentRoot "D:/Workspace/PHP"
Find
Change
After the configuration is complete, check whether the configuration is successful. Restart Apache, create the file index. php in the site directory, and enter the following content:
Mysql section
- After decompression, you can rename the folder and place it in the appropriate location. I suggest you rename the folder MySQLServer5.6 and put it in the C: \ Program Files \ MySQL path. Of course, you can place it in any location you want.
- It is easy to configure environment variables: My computer-> Properties-> Advanced-> environment variables select PATH and add the PATH of your mysql bin folder (for example, C: \ Program Files \ MySQL \ MySQLServer5.6 \ bin)
PATH =...; C: \ Program Files \ MySQL \ MySQLServer5.6 \ bin (note: append, not overwrite)
- Modify the mysql configuration file:
The default profile for the mysql-5.6.1X is in C: \ Program Files \ MySQL Server 5.6 \ my-default.ini
Modify or add configuration () in it ():
[Mysqld]
Basedir = C: \ Program Files \ MySQL \ MySQLServer5.6 (mysql directory)
Datadir = C: \ Program Files \ MySQL \ MySQLServer5.6 \ data (mysql directory \ data)
Run cmd as an administrator (be sure to run it as an administrator, otherwise the permissions are insufficient ),
Enter cd C: \ Program Files \ MySQL \ MySQLServer5.6 \ bin to enter the mysql bin folder (whether or not environment variables are configured, enter the bin folder, otherwise, an error will still be reported when the service is started. 2)
Enter mysqld-install (if you do not need to run it as an administrator, the following error will occur due to insufficient permissions: Install/Remove of the Service Denied !)
Installed successfully
After the installation is successful, start the service. In cmd, enter net start mysql (). The service is started successfully.
The standby command is used to delete mysql (input mysqld-remove) when an error occurs)
Error (error 1067 indicates the configuration file modification error. check whether the configuration file is correct. Error 2: The system cannot find the file. check whether the configuration file has been modified or whether the file is in the bin directory)
After the service is successfully started, you can log on. enter mysql-u root-p (no password for the first login, press enter). The login is successful!
Note:
The encoding of the my. ini file must be an English code (such as ANSI in windows), not a UTF-8 or GBK.
Reference link:
Http://jingyan.baidu.com/article/f3ad7d0ffc061a09c3345bf0.html
Http://www.cnblogs.com/pharen/archive/2012/02/06/2340628.html
The above describes how to configure the runtime environment of php56, including some content, and hope to be helpful to friends who are interested in PHP tutorials.