Php environment configuration in win7 (apache, php, mysql), win7apache_PHP tutorial

Source: Internet
Author: User
Tags apm fully qualified domain name
Configure the php environment (apache, php, mysql) and win7apache in win7. The php environment configuration (apache, php, mysql) in win7 and win7apachewin7 is the 64-bit flagship edition. Installation package: php-5.6.3-Win32-VC11-x64.ziphttpd-2.4.10-win64-VC11.zipmysql-5.6.22-winx64.zip decompress to win7 php environment configuration (apache, php, mysql), win7apache

Win7 is the 64-bit flagship edition.

Installation package:

Php-5.6.3-Win32-VC11-x64.zip

Httpd-2.4.10-win64-VC11.zip

Mysql-5.6.22-winx64.zip

Decompress the package to the corresponding path.

1. php

Copy php. ini-production and change it to php. ini. modify the name as follows:

PHP extension Library Directory extension_dir = "D: \ devsoft \ apm \ php-5.6.3-Win32-VC11-x64 \ ext"; the following extension = xxx, open the corresponding as needed. I open the following items. extension = php_curl.dllextension = php_gd2.dllextension = php_mbstring.dllextension = php_mysql.dllextension = php_pdo_mysql.dllextension = php_xmlrpc.dll; time zone date. timezone = Asia/Shanghai; SESSION saved directory session. save_path = "D: \ config_web \ session_home"; the temporary directory upload_tmp_dir = "D: \ config_web \ upload_home" used to upload files; the disabled function is disabled first, open it later. disable_functions = phpinfo, exec, passthru, popen, proc_open, shell_exec, system, assert, chroot, getcwd, scandir, unlink, delete, rmdir, rename, chgrp, chmod, chown, fopen, copy, mkdir, file, file_get_contents, fputs, fwrite, dir

2. apache

Back up the original httpd. conf and modify it as follows:

# Apache path
ServerRoot "D: \ devsoft \ apm \ httpd-2.4.10-win64-VC11 \ Apache24"

# In LoadModule vhost_alias_module modules/mod_vhost_alias.so
# Add three lines below to support the php module. the php. ini file location and file type processed by php (. php. html. htm)
LoadModule php5_module "D: \ devsoft \ apm \ php-5.6.3-Win32-VC11-x64 \ php5apache2_4.dll"
PHPIniDir "D: \ devsoft \ apm \ php-5.6.3-Win32-VC11-x64"
AddType application/x-httpd-php. php. html. htm

# Url rewriting module. I did a simple test.
LoadModule rewrite_module modules/mod_rewrite.so

Decommission httpd.exe: cocould not reliably determine the server's fully qualified domain name
ServerName localhost: 80
Listen 80

# Web program directory
DocumentRoot "D: \ config_web \ php_web_sum \ php_web"

# Restrict the file access scope
Php_admin_value open_basedir "D: \ config_web \ php_web_sum \ php_web \; D: \ config_web \ log \; D: \ config_web \ upload_home \; D: \ config_web \ session_home \; D: \ config_web \ upload_home_tmp \"

# Options Indexes FollowSymLinks
# Remove Indexes to prevent web browsing directories
Options FollowSymLinks


# Make Apache search for the php file and add index. php

DirectoryIndex index. php index.html


# Rotatelogs controls logs by size and time
ErrorLog "| D:/devsoft/apm/httpd-2.4.10-win64-VC11/Apache24/bin/rotatelogs.exe logs/error _ % Y % m % d. log 5 M 86400 + 480"



LogFormat "% h % l % u % t \" % r \ "%> s % B \" % {Referer} I \ "\" % {User-Agent} I \ "" combined
# Here, I modified the date record format. % t => % {[% Y-% m-% d % H: % M: % S]} t
LogFormat "% h % l % u % {[% Y-% m-% d % H: % M: % S]} t \ "% r \" %> s % B "common


# You need to enable mod_logio.c to use % I and % O
LogFormat "% h % l % u % t \" % r \ "%> s % B \" % {Referer} I \ "\" % {User-Agent} I \ "% I % O" combinedio


# Split logs by 5 MB and days, and change the log file name to end with a date.
CustomLog "| D:/devsoft/apm/httpd-2.4.10-win64-VC11/Apache24/bin/rotatelogs.exe logs/access _ % Y % m % d. log 5 M 86400 + 480" common
LogFormat "% h % l % u % {[% Y-% m-% d % H: % M: % S]} t % {Referer} I-> % U "referer
CustomLog "| D:/devsoft/apm/httpd-2.4.10-win64-VC11/Apache24/bin/rotatelogs.exe logs/referer _ % Y % m % d. log 5 M 86400 + 480" referer
LogFormat "% h % l % u % {[% Y-% m-% d % H: % M: % S]} t % {User-agent} I" agent
CustomLog "| D:/devsoft/apm/httpd-2.4.10-win64-VC11/Apache24/bin/rotatelogs.exe logs/agent _ % Y % m % d. log 5 M 86400 + 480" agent


# Directory Replacement. this role is unknown.

ScriptAlias/cgi-bin/"D: \ devsoft \ apm \ httpd-2.4.10-win64-VC11 \ Apache24 \ cgi-bin \"


# Directory replacement

AllowOverride None
Options None
Require all granted


#403,404 page I set
ErrorDocument 404/missing. php
ErrorDocument 403/forbidden. php

# Php_flag and php_value set the content in php. ini
Php_flag display_startup_errors off
Php_value display_errors off
Php_value error_reporting 2047
Php_flag log_errors on

# Simple test of url rewriting
RewriteEngine on
RewriteRule ^ (. * pai.html $/$ 1.php

# Hiding the apache version number
ServerSignature Off
ServerTokens Prod

# Prohibit access to files with the specified extension

Order allow, deny
Deny from all


# Specify the php log file path
Php_value error_log D: \ config_web \ log \ php_errors.log

# Forbidden access logs

Order allow, deny
Deny from all
Satisfy All

3. mysql

Copy the my-default.ini and rename it my. ini as follows:

[Mysqld]
# Set basedir to your installation pathbasedir = D: \ devsoft \ apm \ mysql-5.6.22-winx64 # set datadir to the location of your data directorydatadir = D: \ devsoft \ apm \ mysql-5.6.22-winx64 \ data # mysql time data type setting explicit_defaults_for_timestamp = TRUEsql_mode = NO_ENGINE_SUBSTITUTION, STRICT_TRANS_TABLES
# Character-set-server = utf8 [mysql]
Default-character-set = utf8

Record the configuration, mainly the directory. apache supports php and permission configuration.

If any problem is found, please point it out in time and I will modify it in time.

Failed to start apache. install vcredist_x64.exe.

Apache failed to start. libssh2.dll is missing. copy libssh2.dll to C: \ Windows \ SysWOW64.

Ghost (apache, php, mysql), win7apache win7 is the 64-bit flagship version. Installation package: php-5.6.3-Win32-VC11-x64.zip httpd-2.4.10-win64-VC11.zip mysql-5.6.22-winx64.zip unzip...

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.