Win7 PHP environment configuration (APACHE,PHP,MYSQL)

Source: Internet
Author: User
Tags apm win32 fully qualified domain name

The 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 to the appropriate path.

1.php

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

;Hide PHP Version numberexpose_php =Off;PHP Extensions Library DirectoryExtension_dir = "D:\devsoft\apm\php-5.6.3-Win32-VC11-x64\ext";The following extension=xxx, if necessary, open the corresponding. 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 Save directory session.save_path = "D:\config_web\session_home"  ; upload_tmp_dir = "D:\config_web\upload_ Home " ; Disabled functions, first disabled, and then opened 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

To back up the original httpd.conf, modify the following:

#apache路径
serverroot "D:\devsoft\apm\httpd-2.4.10-win64-VC11\Apache24"

#在LoadModule Vhost_alias_module modules/mod_vhost_alias.so
#下面增加3行, add support for PHP module, php.ini file location, file type (. php. html. htm) processed by PHP
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重写模块, I did a simple test.
LoadModule rewrite_module modules/mod_rewrite.so

#解决httpd. Exe:could not reliably determine the server ' s fully qualified domain name
ServerName localhost:80
Listen

#web程序目录
documentroot "D:\config_web\php_web_sum\php_web"
<directory "D:\config_web\php_web_sum\php_web" >
#限制用户访问文件的范围
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
#Indexes removed to prevent browsing the directory from the Web
Options followsymlinks
</Directory>

#使Apache首先寻找php文件, Increase index.php
<ifmodule dir_module>
directoryindex index.php index.html
</IfModule>

#rotatelogs按大小, time to control the log
errorlog "| D:/devsoft/apm/httpd-2.4.10-win64-vc11/apache24/bin/rotatelogs.exe logs/error_%y%m%d.log 5M 86400 +480 "

<ifmodule log_config_module>

Logformat "%h%l%u%t \"%r\ "%>s%b \"%{referer}i\ "\"%{user-agent}i\ "" Combined
   #此处, 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
    
<ifmodule logio_module>
# 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
</IfModule>

   #使日志按5M, the day is split, and the log file name is changed 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 5M 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 5M 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 5M 86400 +480 "Agent
</IfModule>

#目录替换, this role is unknown.
<ifmodule alias_module>
scriptalias/cgi-bin/"D:\devsoft\apm\httpd-2.4.10-win64-VC11\Apache24\cgi-bin\"
</IfModule>

#目录替换
<directory "D:\devsoft\apm\httpd-2.4.10-win64-VC11\Apache24\cgi-bin" >
allowoverride None
Options None
Require All granted
</Directory>

#我设置的403, 404 pages
errordocument 404/missing.php
errordocument 403/forbidden.php

#php_flag和php_value设置php the contents of the. ini
Php_flag display_startup_errors off
Php_value display_errors off
php_value error_reporting 2047
Php_flag log_errors on

#简单测试了下url重写
Rewriteengine on
rewriterule ^ (. *). html$/$1.php

#隐藏apache版本号
serversignature Off
Servertokens Prod

#禁止访问指定扩展名文件
<files ~ "(. *) \. (exe|inc|log|sh|py|pyc|h|c) $ ">
Order Allow,deny
Deny from all
</Files>

#指定php日志文件路径
Php_value Error_log D:\config_web\log\php_errors.log

#禁止访问日志
<files "D:\config_web\log\php_errors.log" >
Order Allow,deny
Deny from all
Satisfy All
</Files>

3.mysql

Copy the My-default.ini, rename it to My.ini, and modify it as follows:

[Mysqld]
# set Basedir to your installation pathbasedir=d:\devsoft\apm\mysql-5.6.22-winx64# set DataDir to the Locati On your data directorydatadir=d:\devsoft\apm\mysql-5.6.22-winx64\data#mysql时间数据类型的设置explicit_ Defaults_for_timestamp=truesql_mode=no_engine_substitution,strict_trans_tables
#编码设置Character-set-server=utf8 [MySQL]
Default-character-set=utf8

Logging configuration, mainly directory, Apache support PHP, and the configuration of permissions.

Please point out the problem in time and I will revise it in time.

Apache failed to boot, install Vcredist_x64.exe.

Apache failed to start, missing libssh2.dll, Libssh2.dll copied to C:\Windows\SysWOW64 after resolution.

Win7 PHP environment configuration (APACHE,PHP,MYSQL)

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.