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 后解决。

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

热门话题











要在 Apache 中设置 CGI 目录,需要执行以下步骤:创建 CGI 目录,如 "cgi-bin",并授予 Apache 写入权限。在 Apache 配置文件中添加 "ScriptAlias" 指令块,将 CGI 目录映射到 "/cgi-bin" URL。重启 Apache。

启动 Apache 的步骤如下:安装 Apache(命令:sudo apt-get install apache2 或从官网下载)启动 Apache(Linux:sudo systemctl start apache2;Windows:右键“Apache2.4”服务并选择“启动”)检查是否已启动(Linux:sudo systemctl status apache2;Windows:查看服务管理器中“Apache2.4”服务的状态)启用开机自动启动(可选,Linux:sudo systemctl

当 Apache 80 端口被占用时,解决方法如下:找出占用该端口的进程并关闭它。检查防火墙设置以确保 Apache 未被阻止。如果以上方法无效,请重新配置 Apache 使用不同的端口。重启 Apache 服务。

Apache 连接数据库需要以下步骤:安装数据库驱动程序。配置 web.xml 文件以创建连接池。创建 JDBC 数据源,指定连接设置。从 Java 代码中使用 JDBC API 访问数据库,包括获取连接、创建语句、绑定参数、执行查询或更新以及处理结果。

要从 Apache 中删除多余的 ServerName 指令,可以采取以下步骤:识别并删除多余的 ServerName 指令。重新启动 Apache 使更改生效。检查配置文件验证更改。测试服务器确保问题已解决。

本文探讨如何在Debian系统上提升Hadoop数据处理效率。优化策略涵盖硬件升级、操作系统参数调整、Hadoop配置修改以及高效算法和工具的运用。一、硬件资源强化确保所有节点硬件配置一致,尤其关注CPU、内存和网络设备性能。选择高性能硬件组件对于提升整体处理速度至关重要。二、操作系统调优文件描述符和网络连接数:修改/etc/security/limits.conf文件,增加系统允许同时打开的文件描述符和网络连接数上限。JVM参数调整:在hadoop-env.sh文件中调整

本文将阐述如何通过分析Debian系统下的Apache日志来提升网站性能。一、日志分析基础Apache日志记录了所有HTTP请求的详细信息,包括IP地址、时间戳、请求URL、HTTP方法和响应代码等。在Debian系统中,这些日志通常位于/var/log/apache2/access.log和/var/log/apache2/error.log目录下。理解日志结构是有效分析的第一步。二、日志分析工具您可以使用多种工具分析Apache日志:命令行工具:grep、awk、sed等命令行工具可

有 3 种方法可在 Apache 服务器上查看版本:通过命令行(apachectl -v 或 apache2ctl -v)、检查服务器状态页(http://<服务器IP或域名>/server-status)或查看 Apache 配置文件(ServerVersion: Apache/<版本号>)。
