win7下php环境配置(apache,php,mysql),win7apache
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>
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>
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>
记录下配置,主要是目录,apache支持php,还有权限的配置。
发现问题请及时指出,我会及时修改。
apache启动失败,安装 vcredist_x64.exe。
apache启动失败,缺少libssh2.dll,把libssh2.dll 复制到 C:\Windows\SysWOW64 后解决。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics





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.

The steps to start Apache are as follows: Install Apache (command: sudo apt-get install apache2 or download it from the official website) Start Apache (Linux: sudo systemctl start apache2; Windows: Right-click the "Apache2.4" service and select "Start") Check whether it has been started (Linux: sudo systemctl status apache2; Windows: Check the status of the "Apache2.4" service in the service manager) Enable boot automatically (optional, Linux: sudo systemctl

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.

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.

This article discusses how to improve Hadoop data processing efficiency on Debian systems. Optimization strategies cover hardware upgrades, operating system parameter adjustments, Hadoop configuration modifications, and the use of efficient algorithms and tools. 1. Hardware resource strengthening ensures that all nodes have consistent hardware configurations, especially paying attention to CPU, memory and network equipment performance. Choosing high-performance hardware components is essential to improve overall processing speed. 2. Operating system tunes file descriptors and network connections: Modify the /etc/security/limits.conf file to increase the upper limit of file descriptors and network connections allowed to be opened at the same time by the system. JVM parameter adjustment: Adjust in hadoop-env.sh file

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.

This article will explain how to improve website performance by analyzing Apache logs under the Debian system. 1. Log Analysis Basics Apache log records the detailed information of all HTTP requests, including IP address, timestamp, request URL, HTTP method and response code. In Debian systems, these logs are usually located in the /var/log/apache2/access.log and /var/log/apache2/error.log directories. Understanding the log structure is the first step in effective analysis. 2. Log analysis tool You can use a variety of tools to analyze Apache logs: Command line tools: grep, awk, sed and other command line tools.

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://<server IP or domain name>/server-status), or view the Apache configuration file (ServerVersion: Apache/<version number>).
