Table of Contents
win7下php环境配置(apache,php,mysql),win7apache
Home Backend Development PHP Tutorial PHP environment configuration (apache, php, mysql) under win7, win7apache_PHP tutorial

PHP environment configuration (apache, php, mysql) under win7, win7apache_PHP tutorial

Jul 13, 2016 am 10:06 AM
apache

win7下php环境配置(apache,php,mysql),win7apache

win7是64位旗舰版。

安装包:

php-5.6.3-Win32-VC11-x64.zip

httpd-2.4.10-win64-VC11.zip

mysql-5.6.22-winx64.zip

解压到相应的路径。

1.php

复制php.ini-production,并改名为php.ini,修改如下:

<span>;<span>隐藏PHP版本号
<span>expose_php =</span><span> Off
<span>;<span>php扩充库目录
<span>extension_dir = "D:\devsoft\apm\php-5.6.3-Win32-VC11-x64\ext"</span>
<span>;<span>以下extension=xxx,根据需要打开相应的.我打开以下几项.
<span>extension=</span><span>php_curl.dll
extension=<span>php_gd2.dll
extension=<span>php_mbstring.dll
extension=<span>php_mysql.dll
extension=<span>php_pdo_mysql.dll
extension=<span>php_xmlrpc.dll
<span>;<span>时区
<span>date.timezone =</span><span> Asia/Shanghai
<span>;<span>SESSION保存目录
<span>session.save_path = "D:\config_web\session_home"</span>
<span>;<span>上传文件时使用的临时目录
<span>upload_tmp_dir = "D:\config_web\upload_home"</span>

<span>;<span>禁用的函数,先禁用,以后用再打开.
<span>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</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
Copy after login

2.apache

备份原来的httpd.conf,修改如下:

<span>#apache路径<br /><span>ServerRoot "D:\devsoft\apm\httpd-2.4.10-win64-VC11\Apache24"</span><br /><br /><span>#在LoadModule vhost_alias_module modules/mod_vhost_alias.so<br /><span>#下面增加3行,增加对php模块的支持,php.ini文件位置,由php处理的文件类型(.php .html .htm)<br /><span>LoadModule php5_module "D:\devsoft\apm\php-5.6.3-Win32-VC11-x64\php5apache2_4.dll"</span><br /><span>PHPIniDir "D:\devsoft\apm\php-5.6.3-Win32-VC11-x64"</span><br /><span>AddType application/x-httpd-php .php .html .htm</span><br /><br /><span>#url重写模块,我做了简单的测试<br /><span>LoadModule rewrite_module modules/mod_rewrite.so</span><br /><br /><span>#解决httpd.exe: Could not reliably determine the server's fully qualified domain name<br /><span>ServerName localhost:80</span><br /><span>Listen 80</span><br /><br /><span>#web程序目录<br /><span>DocumentRoot "D:\config_web\php_web_sum\php_web"</span><br /><span><Directory "D:\config_web\php_web_sum\php_web"></span><br /><span>#限制用户访问文件的范围<br /><span>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\"</span><br /><br /><span>  #Options Indexes FollowSymLinks<br /><span>  #Indexes 去掉,防止从web浏览目录<br /><span>  Options FollowSymLinks</span><br /><span></Directory></span><br /><br /><span>#使Apache首先寻找php文件,增加index.php<br /><span><IfModule dir_module></span><br /><span>    DirectoryIndex index.php index.html</span><br /><span></IfModule></span><br /><br /><span>#rotatelogs按大小,时间来控制日志<br /><span>ErrorLog "|D:/devsoft/apm/httpd-2.4.10-win64-VC11/Apache24/bin/rotatelogs.exe logs/error_%Y%m%d.log 5M 86400 +480"</span><br /><br /><span><IfModule log_config_module></span><br /><br /><span>    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined</span><br />  <span>#此处,我修改了日期记录格式. <span>%t <span>=></span> <span>%{[%Y-%m-%d %H:%M:%S]}t<br /><span>    LogFormat "%h %l %u %{[%Y-%m-%d %H:%M:%S]}t \"%r\" %>s %b" common</span><br /><span>    </span><br /><span>    <IfModule logio_module></span><br /><span>      # You need to enable mod_logio.c to use %I and %O</span><br /><span>      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio</span><br /><span>    </IfModule></span><br /><br />  <span>#使日志按5M,天为单位进行分割,同时日志文件名称改为以日期结尾.<br /><span>    CustomLog "|D:/devsoft/apm/httpd-2.4.10-win64-VC11/Apache24/bin/rotatelogs.exe logs/access_%Y%m%d.log 5M 86400 +480" common</span><br /><span>    LogFormat "%h %l %u %{[%Y-%m-%d %H:%M:%S]}t %{Referer}i -> %U" referer</span><br /><span>    CustomLog "|D:/devsoft/apm/httpd-2.4.10-win64-VC11/Apache24/bin/rotatelogs.exe logs/referer_%Y%m%d.log 5M 86400 +480" referer</span><br /><span>    LogFormat "%h %l %u %{[%Y-%m-%d %H:%M:%S]}t %{User-agent}i" agent</span><br /><span>    CustomLog "|D:/devsoft/apm/httpd-2.4.10-win64-VC11/Apache24/bin/rotatelogs.exe logs/agent_%Y%m%d.log 5M 86400 +480" agent</span><br /><span></IfModule></span><br /><br /><span>#目录替换,这项作用还未知.<br /><span><IfModule alias_module></span><br /><span>    ScriptAlias /cgi-bin/ "D:\devsoft\apm\httpd-2.4.10-win64-VC11\Apache24\cgi-bin\"</span><br /><span></IfModule></span><br /><br /><span>#目录替换<br /><span><Directory "D:\devsoft\apm\httpd-2.4.10-win64-VC11\Apache24\cgi-bin"></span><br /><span>    AllowOverride None</span><br /><span>    Options None</span><br /><span>    Require all granted</span><br /><span></Directory></span><br /><br /><span>#我设置的403,404页面<br /><span>ErrorDocument 404 /missing.php</span><br /><span>ErrorDocument 403 /forbidden.php</span><br /><br /><span>#php_flag和php_value设置php.ini中的内容<br /><span>php_flag display_startup_errors off</span><br /><span>php_value display_errors off</span><br /><span>php_value error_reporting 2047</span><br /><span>php_flag log_errors on</span><br /><br /><span>#简单测试了下url重写<br /><span>RewriteEngine on</span><br /><span>RewriteRule ^(.*).html$ /$1.php</span><br /><br /><span>#隐藏apache版本号<br /><span>ServerSignature Off</span><br /><span>ServerTokens Prod</span><br /><br /><span>#禁止访问指定扩展名文件<br /><span><Files ~ "(.*)\.(exe|inc|log|sh|py|pyc|h|c)$"></span><br /><span>    Order allow,deny</span><br /><span>    Deny from all</span><br /><span></Files></span><br /><br /><span>#指定php日志文件路径<br /><span>php_value error_log D:\config_web\log\php_errors.log</span><br /><br /><span>#禁止访问日志<br /><span><Files "D:\config_web\log\php_errors.log"></span><br /><span> Order allow,deny</span><br /><span> Deny from all</span><br /><span> Satisfy All</span><br /><span></Files>
</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span>
Copy after login

3.mysql

复制my-default.ini,并重命名为my.ini,修改如下:

<span><span>[mysqld]<br /><span># set basedir to your installation path</span>
basedir=D:\devsoft\apm\mysql-5.6.22-winx64
<span># set datadir to the location of your data directory
<span>datadir=D:\devsoft\apm\mysql-5.6.22-winx64\data</span>
<span>#mysql时间数据类型的设置
<span>explicit_defaults_for_timestamp=TRUE
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES</span> <br /><span>#编码设置
<span>character-set-server=utf8</span> 

[mysql]<br /><span>default-character-set=utf8</span></span></span></span></span></span>
Copy after login

 

记录下配置,主要是目录,apache支持php,还有权限的配置。

发现问题请及时指出,我会及时修改。

apache启动失败,安装 vcredist_x64.exe。

apache启动失败,缺少libssh2.dll,把libssh2.dll 复制到 C:\Windows\SysWOW64 后解决。

 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/962879.htmlTechArticlewin7下php环境配置(apache,php,mysql),win7apache win7是64位旗舰版。 安装包: php-5.6.3-Win32-VC11-x64.zip httpd-2.4.10-win64-VC11.zip mysql-5.6.22-winx64.zip 解压到...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to set the cgi directory in apache How to set the cgi directory in apache Apr 13, 2025 pm 01:18 PM

To set up a CGI directory in Apache, you need to perform the following steps: Create a CGI directory such as "cgi-bin", and grant Apache write permissions. Add the "ScriptAlias" directive block in the Apache configuration file to map the CGI directory to the "/cgi-bin" URL. Restart Apache.

What to do if the apache80 port is occupied What to do if the apache80 port is occupied Apr 13, 2025 pm 01:24 PM

When the Apache 80 port is occupied, the solution is as follows: find out the process that occupies the port and close it. Check the firewall settings to make sure Apache is not blocked. If the above method does not work, please reconfigure Apache to use a different port. Restart the Apache service.

How to connect to the database of apache How to connect to the database of apache Apr 13, 2025 pm 01:03 PM

Apache connects to a database requires the following steps: Install the database driver. Configure the web.xml file to create a connection pool. Create a JDBC data source and specify the connection settings. Use the JDBC API to access the database from Java code, including getting connections, creating statements, binding parameters, executing queries or updates, and processing results.

How to view your apache version How to view your apache version Apr 13, 2025 pm 01:15 PM

There are 3 ways to view the version on the Apache server: via the command line (apachectl -v or apache2ctl -v), check the server status page (http://&lt;server IP or domain name&gt;/server-status), or view the Apache configuration file (ServerVersion: Apache/&lt;version number&gt;).

How to view the apache version How to view the apache version Apr 13, 2025 pm 01:00 PM

How to view the Apache version? Start the Apache server: Use sudo service apache2 start to start the server. View version number: Use one of the following methods to view version: Command line: Run the apache2 -v command. Server Status Page: Access the default port of the Apache server (usually 80) in a web browser, and the version information is displayed at the bottom of the page.

How to configure zend for apache How to configure zend for apache Apr 13, 2025 pm 12:57 PM

How to configure Zend in Apache? The steps to configure Zend Framework in an Apache Web Server are as follows: Install Zend Framework and extract it into the Web Server directory. Create a .htaccess file. Create the Zend application directory and add the index.php file. Configure the Zend application (application.ini). Restart the Apache Web server.

How to delete more than server names of apache How to delete more than server names of apache Apr 13, 2025 pm 01:09 PM

To delete an extra ServerName directive from Apache, you can take the following steps: Identify and delete the extra ServerName directive. Restart Apache to make the changes take effect. Check the configuration file to verify changes. Test the server to make sure the problem is resolved.

How to solve the problem that apache cannot be started How to solve the problem that apache cannot be started Apr 13, 2025 pm 01:21 PM

Apache cannot start because the following reasons may be: Configuration file syntax error. Conflict with other application ports. Permissions issue. Out of memory. Process deadlock. Daemon failure. SELinux permissions issues. Firewall problem. Software conflict.

See all articles