php开发环境配置记录


Posted in PHP onJanuary 14, 2011

【apache安装】

httpd.exe -k install -n "apache2.2.15" 
httpd.exe -k start -n "apache2.2.15"

【apache卸载】
httpd.exe -k stop -n "apache2.2.15" 
httpd.exe -k uninstall -n "apache2.2.15"

【httpd.conf配置关键】
ServerRoot "D:/APM/Apache2.2.15" 
Listen 80 
# 压缩发送给客户端的内容 gzip支持 
#LoadModule deflate_module modules/mod_deflate.so 
# LoadModule cgi_module modules/mod_cgi.so 
# fastcgi 
LoadModule fcgid_module modules/mod_fcgid.so 
LoadModule rewrite_module modules/mod_rewrite.so 
DocumentRoot "D:/APM/Apache2.2.15/htdocs" 
# 支持 php 脚本 
# fastcgi模式将此行注释 
# 直接在虚拟主机中可配置每个站点使用不同版本的php 或者不同的cgi 
#Include conf/extra/httpd-php.conf 
# Fancy directory listings 华丽的目录清单 
Include conf/extra/httpd-autoindex.conf 
# Virtual hosts 虚拟主机 
#Include conf/extra/httpd-vhosts.conf 
# fastcgi模式虚拟主机 
Include conf/extra/httpd-vhosts-fcgid.conf 
# Various default settings 页脚显示版本信息AccessFileName .htaccess 
Include conf/extra/httpd-default.conf

【httpd-php.conf参考】
# 
# 查找 /APM/php-5.2.12-Win32 替换 
# 
SetEnv PHPRC "/APM/php-5.2.12-Win32" 
SetEnv TMP "/tmp" 
# UnsetEnv PERL5LIB 
# 加载dll省去在PATH中添加php路径 
#LoadFile "/APM/php-5.2.12-Win32/libpq.dll" 
LoadFile "/APM/php-5.2.12-Win32/libmysql.dll" 
LoadFile "/APM/php-5.2.12-Win32/libmcrypt.dll" 
LoadFile "/APM/php-5.2.12-Win32/libmhash.dll" 
LoadFile "/APM/php-5.2.12-Win32/libeay32.dll" 
LoadFile /APM/php-5.2.12-Win32/ssleay32.dll 
# 
# PHP-Module setup 
# 
LoadFile "/APM/php-5.2.12-Win32/php5ts.dll" 
LoadModule php5_module "/APM/php-5.2.12-Win32/php5apache2_2.dll" 
SetHandler application/x-httpd-php 
SetHandler application/x-httpd-php-source 
# Load php.ini File Dir 
PHPIniDir "/APM/php-5.2.12-Win32" 
AddType text/html .php .phps

【httpd-vhosts.conf参考】
NameVirtualHost *:80 
#文档目录 
DocumentRoot "/vhosts/localhost" 
#名字 如www.php.net 
ServerName localhost 
#别名 如php.net 
ServerAlias 127.0.0.1 
#错误日志文件 
ErrorLog "logs/dummy-host.localhost-error_log" 
#目录访问规则 
Options Indexes FollowSymLinks 
AllowOverride All 
Order allow,deny 
Allow from all 
#目录索引文件 
DirectoryIndex index.html index.htm index.php 
[html] 
【httpd-vhosts-fcgid.conf参考】 
[code] 
#FcgidInitialEnv PHPRC "/APM/php5210" 
#FcgidInitialEnv PATH "/APM/php5210;C:/WINDOWS/system32;C:/WINDOWS;C:/WINDOWS/System32/Wbem;" 
#FcgidInitialEnv SystemRoot "C:/Windows" 
#FcgidInitialEnv SystemDrive "C:" 
#FcgidInitialEnv TEMP "C:/WINDOWS/Temp" 
#FcgidInitialEnv TMP "C:/WINDOWS/Temp" 
#FcgidInitialEnv windir "C:/WINDOWS" 
FcgidIOTimeout 64 
FcgidConnectTimeout 16 
FcgidMaxRequestsPerProcess 500 
NameVirtualHost *:80 
DocumentRoot "/vhosts/localhost" 
ServerName localhost 
ServerAlias 127.0.0.1 
ErrorLog "logs/dummy-host.localhost-error_log" 
Options Indexes FollowSymLinks ExecCGI 
#Options +ExecCGI 
AllowOverride All 
#AddHandler fcgid-script .php 
#FCGIWrapper /APM/php5210/php-cgi.exe .php 
#" 
AddHandler fcgid-script .php 
FcgidWrapper "/APM/php-5.2.13-nts-Win32/php-cgi.exe" .php 
#FcgidWrapper "/APM/php-5.3.2-nts-Win32-VC6-x86/php-cgi.exe" .php 
# 
Order allow,deny 
Allow from all 
DirectoryIndex index.html index.htm index.php

【Mysql安装】
mysqld-nt.exe --install MySQL5.0.45-community-nt --defaults-file=D:\APM\mysql5.0.45\my.ini 
net start MySQL5.0.45-community-nt

【Mysql卸载】
net stop MySQL5.0.45-community-nt 
mysqld-nt.exe --remove MySQL5.0.45-community-nt

【my.ini参考】
[mysqld] 
basedir="D:\APM\mysql5.0.45\" 
datadir="D:\APM\mysql5.0.45\Data\" 
tmpdir="D:\APM\mysql5.0.45\tmp\" 
# log="D:\APM\mysql5.0.45\tmp\mysql.log" 
default-character-set=utf8 
port=3306 
interactive_timeout=5 
wait_timeout=5 
skip-locking 
skip-innodb 
skip-bdb 
ft_min_word_len=1 
[mysqld] 
port=3306 
basedir="D:/mysql/" 
datadir="D:/mysql/Data/" 
tmpdir="d:/mysql/tmp/" 
default-character-set=utf8 
default-storage-engine=MYISAM 
skip-bdb 
skip-innodb 
skip-locking 
key_buffer=16M 
max_allowed_packet=1M 
table_cache=128 
thread_cache=8 
join_buffer_size=512K 
sort_buffer=512K 
record_buffer=512K 
max_connections=500 
wait_timeout=120 
interactive_timeout=120 
max_connect_errors=3000 
long_query_time=1 
max_heap_table_size=16M 
tmp_table_size=8M 
thread_concurrency=8 
myisam_sort_buffer_size=8M 
myisam_sort_buffer_size=4M 
low_priority_updates=1 
ft_min_word_len=1

【php.ini配置参考】
output_buffering = On 
disable_functions = system,passthru,shell_exec,exec,popen,proc_open 
enable_dl = Off upload_tmp_dir = "D:/tmp/uploadtemp/" 
session.save_path = "d:/tmp/sessiondata/" 
date.timezone = "Etc/GMT-8" ;表示的是 GMT+8 
mbstring.language = Neutral ; Set default language to Neutral(UTF-8) (default) 
mbstring.internal_encoding = UTF-8 ; Set internal encoding to UTF-8 
cgi.force_redirect = 0 
cgi.fix_pathinfo = 1 
fastcgi.impersonate = 1 
[eaccelerator] 
;zend_extension="/APM/ext/eAccelerator_v0_9_6_for_v5_2_13-VC6/eAccelerator.dll" 
;zend_extension="/APM/ext/eAccelerator_v1_0_svn412_for_v5_2_13-VC6/eAccelerator.dll" 
eaccelerator.shm_size="16" 
eaccelerator.cache_dir="/tmp/eaccelerator" 
eaccelerator.enable="1" 
eaccelerator.optimizer="1" 
eaccelerator.check_mtime="1" 
eaccelerator.debug="0" 
;eaccelerator.log_file="/var/log/httpd/eaccelerator_log" 
eaccelerator.filter="" 
eaccelerator.shm_max="0" 
eaccelerator.shm_ttl="300" 
eaccelerator.shm_prune_period="0" 
eaccelerator.shm_only="0" 
eaccelerator.compress="1" 
eaccelerator.compress_level="9" 
[Zend] 
zend_optimizer.optimization_level=15 
zend_optimizer.encoder_loader=0 
;zend_extension_ts="/APM/ext/ZendOptimizer-3.3.0/lib/Optimizer-3.3.0/php-5.2.x/ZendOptimizer.dll" 
;zend_extension="/APM/ext/ZendOptimizer_nts.dll" 
;zend_extension="/APM/ext/ZendOptimizerPlus.dll" 
; 下面是使用ZendExtensionManager.dll的参考配置 
;zend_extension_manager.optimizer_ts="/APM/Zend/ZendOptimizer-3.3.0/lib/Optimizer-3.3.0" 
;zend_extension_ts="/APM/Zend/ZendOptimizer-3.3.0/lib/ZendExtensionManager.dll" 
;zend_extension_manager.debug_server_ts="/APM/Zend/ZendOptimizer-3.3.0/lib/ZendDebugger-5.2.13-cygwin_nt-i386" 
;zend_debugger.expose_remotely=always 
;zend_debugger.allow_hosts=127.0.0.1/32 
;zend_debugger.allow_tunnel=127.0.0.1/32 
[ZendDebugger] 
; 放到后边可以和zend_optimizer同时加载 
;zend_extension_ts="/APM/ext/ZendDebugger-5.2.15RC1-cygwin_nt-i386/php-5.2.x/ZendDebugger.dll" 
[xcache-common] 
;zend_extension="D:/APM/ext/XCache-1.3.0-php-5.2.10-nts-Win32-VC6-x86/php_xcache.dll" 
; extension = php_xcache.dll 
[xcache.admin] 
xcache.admin.enable_auth = Off 
xcache.admin.user = "mOo" 
; xcache.admin.pass = md5($您的密码) 
xcache.admin.pass = "" 
[xcache] 
; 这里的多数选项仅在 ini 里可以修改, 这里列出的都是默认值, 除非另外说明 
; select low level shm/allocator scheme implemenation 
xcache.shm_scheme = "mmap" 
; 禁用: xcache.size=0 
; 启用: xcache.size=64M 之类 (任意>0的值) 同时请注意您的系统 mmap 上限 
xcache.size = 0 
; 建议设置为 cpu 数 (cat /proc/cpuinfo |grep -c processor) 
xcache.count = 1 
; 只是个参考值, 您可以放心地存储多于此数量的项目(php脚本/变量) 
xcache.slots = 8K 
; 缓存项目的 ttl, 0=永久 
xcache.ttl = 0 
; 扫描过期项目的时间间隔, 0=不扫描, 其他值以秒为单位 
xcache.gc_interval = 60 
; 同上, 只是针对变量缓存设置 
xcache.var_size = 1M 
xcache.var_count = 1 
xcache.var_slots = 8K 
; 默认, 允许 ini_set() 
xcache.var_ttl = 0 
; 最大ttl值 
xcache.var_maxttl = 0 
xcache.var_gc_interval = 300 
; 仅测试用 
xcache.test = Off 
; /dev/zero 时无效 
xcache.readonly_protection = Off 
; 对于 *nix 系统, xcache.mmap_path 是文件路径而不是目录, (可以不存在 但是必须能创建). 
; 如果您期望启用 ReadonlyProtection, 可以使用类似 "/tmp/xcache" 
; 2 个 php 组不会共享同一个 /tmp/xcache 
; 对于 Win32 系统, xcache.mmap_path=匿名MAP名字, 不是文件路径. 建议使用 XCache 字眼避免跟其他软件冲突 
xcache.mmap_path = "XCache" 
; 仅用于 *nix 系统 
; 设置为空(禁用) 或者类似 "/tmp/phpcore/" 
; 注意该目录应该能被 php 写入文件 (跟 open_basedir 无关) 
xcache.coredump_directory = "" 
xcache.cacher = On 
xcache.stat = On 
xcache.optimizer = Off 
[xcache.coverager] 
; 如果 xcache.coveragedump_directory 设置为空则本设置自动为 Off 
xcache.coverager = Off 
; 请确保本目录能被 coverage viewer 脚本读取 (注意 open_basedir) 
; 依赖于 xcache.coverager=On 
xcache.coveragedump_directory = "" 
[Xdebug] 
xdebug.var_display_max_depth = 10 
;xdebug.remote_autostart = 1 
;xdebug.remote_enable=1 
;xdebug.remote_handler=dbgp 
;xdebug.remote_host=127.0.0.1 
;xdebug.remote_mode=req 
;xdebug.idekey=default 
;xdebug.remote_log="/xdebug.log" 
;xdebug.remote_port=9000 
xdebug.auto_trace=off 
;xdebug.collect_params=on 
;xdebug.collect_return=on 
xdebug.trace_output_dir="/tmp/xdebug" 
xdebug.profiler_enable=off 
xdebug.profiler_output_dir="/tmp/xdebug" 
;zend_extension_ts="/APM/ext/xdebug/php_xdebug-2.0.5-5.2.dll" 
;zend_extension="/APM/ext/xdebug/php_xdebug-2.0.5-5.2-nts.dll" 
zend_extension="/APM/ext/xdebug/php_xdebug-2.1.0beta3-5.2-vc6-nts.dll"

【IIS ISAPI】
添加环境变量 PHPRC=D:\PHP 这个是通知iis读取php.ini文件的路径。 
在PATH中加入 D:\PHP 能读取相关动态链接库。 
添加一个新的web服务扩展 php d:\php\php5isapi.dll 
添加应用程序扩展名映射 可执行文件 d:\php\php5isapi.dll 扩展名.php 
重启IIS php就可以用了。

【IIS FastCGI PHP】
这个不用添加环境变量和修改PATH变量。 
先安装FastCGI,安装程序会自动添加 
Web 服务扩展 - FastCGI Handler 
c:\windows\system32\inetsrv\fcgiext.dll 
并设置为允许。 
修改c:\windows\system32\inetsrv\fcgiext.ini 
[Types] 
php=PHP 
[PHP] 
ExePath=D:\php\php-cgi.exe 
InstanceMaxRequests=10000 
EnvironmentVars=PHP_FCGI_MAX_REQUESTS:10000 
添加应用程序扩展名映射 可执行文件 c:\windows\system32\inetsrv\fcgiext.dll 扩展名.php 
重启iis就行了。

【ISAPI_Rewrite 参考】
RewriteEngine On 
RewriteBase / RewriteCond %{HTTP_HOST} ^03188.net [NC] 
RewriteRule ^(.*)$ http://www.03188.net/$1 [L,R=301] 
#### RewriteCond %{REQUEST_URI} ^[A-Z]{3,9}\ /index\.php\ HTTP / 
# RewriteRule ^index\.(php|htm|html)$ http://www.03188.net/ [R=301,L] 
RewriteRule ^([a-z]+)/(.*)/(.*)/(.*)\.htm$ index.php?action=$1&option=$2&extent=$3&info=$4 [L] 
RewriteRule ^([a-z]+)/(.*)/(.*)\.htm$ index.php?action=$1&option=$2&extent=$3&info=$3 [L] 
RewriteRule ^([a-z]+)/(.*)\.htm$ index.php?action=$1&option=$2 [L] 
RewriteRule ^([a-z]+)\.htm$ index.php?action=$1 [L] 
# RewriteRule ^(.*)\.asp$ http://www.03188.net [L,R=301] 
# 修改完整模式下被抓取的url使有效 
# RewriteRule ^index\.php/([a-z]+)/(.*)/(.*)\.htm$ $1/$2/$3\.htm [L,R=301] 
# RewriteRule ^index\.php/([a-z]+)/(.*)\.htm$ $1/$2\.htm [L,R=301] 
# 修改论坛移动后出现No input file specified. 
# RewriteRule ^bbs/(.*)$ http://bbs.03188.net/$1 [L,R=301] 
# 修改人力资源hr 
# RewriteRule ^hr/(.*)$ http://hr.03188.net/$1 [L,R=301]
PHP 相关文章推荐
配置PHP使之能同时支持GIF和JPEG
Oct 09 PHP
一个php作的文本留言本的例子(三)
Oct 09 PHP
打造计数器DIY三步曲(下)
Oct 09 PHP
超强分页类2.0发布,支持自定义风格,默认4种显示模式
Jan 02 PHP
PHP通过正则表达式下载图片到本地的实现代码
Sep 19 PHP
解析Extjs与php数据交互(增删查改)
Jun 25 PHP
php实现的Captcha验证码类实例
Sep 22 PHP
php中smarty模板条件判断用法实例
Jun 11 PHP
php封装db类连接sqlite3数据库的方法实例
Dec 19 PHP
PHP+MySQL实现消息队列的方法分析
May 09 PHP
PHP explode()函数用法讲解
Feb 15 PHP
laravel 配置路由 api和web定义的路由的区别详解
Sep 03 PHP
PHP文件读写操作之文件写入代码
Jan 13 #PHP
PHP文件读写操作之文件读取方法详解
Jan 13 #PHP
PHP目录函数实现创建、读取目录教程实例
Jan 13 #PHP
PHP开发规范手册之PHP代码规范详解
Jan 13 #PHP
PHP JSON格式数据交互实例代码详解
Jan 13 #PHP
PHP学习笔记之二 php入门知识
Jan 12 #PHP
php算开始时间到过期时间的相隔的天数
Jan 12 #PHP
You might like
PHP操作xml代码
2010/06/17 PHP
探讨:parse url解析URL,返回其组成部分
2013/06/14 PHP
Yii框架连接mongodb数据库的代码
2016/07/27 PHP
Laravel日志用法详解
2016/10/09 PHP
Prototype Class对象学习
2009/07/19 Javascript
js中的string.format函数代码
2020/08/11 Javascript
基于jquery实现的文字向上跑动类似跑马灯的效果
2014/06/17 Javascript
用jquery修复在iframe下的页面锚点失效问题
2014/08/22 Javascript
如何用JavaScript定义一个类
2014/09/12 Javascript
JAVA四种基本排序方法实例总结
2015/07/24 Javascript
javascript弹出拖动窗口
2015/08/11 Javascript
ThinkJS中如何使用MongoDB的CURD操作
2016/12/13 Javascript
Node.js中的http请求客户端示例(request client)
2017/05/04 Javascript
vue.js使用v-if实现显示与隐藏功能示例
2018/07/06 Javascript
ng-alain表单使用方式详解
2018/07/10 Javascript
jQuery ajax仿Google自动提示SearchSuggess功能示例
2019/03/28 jQuery
[01:23:59]2018DOTA2亚洲邀请赛 4.1 小组赛 B组 VP vs Secret
2018/04/03 DOTA
Python实现MySQL操作的方法小结【安装,连接,增删改查等】
2017/07/12 Python
Python 中字符串拼接的多种方法
2018/07/30 Python
Python基础学习之时间转换函数用法详解
2019/06/18 Python
详解DeBug Python神级工具PySnooper
2019/07/03 Python
keras输出预测值和真实值方式
2020/06/27 Python
PyCharm 解决找不到新打开项目的窗口问题
2021/01/15 Python
python+opencv3.4.0 实现HOG+SVM行人检测的示例代码
2021/01/28 Python
利用简洁的图片预加载组件提升html5移动页面的用户体验
2016/03/11 HTML / CSS
找到不普通的东西:Bonanza
2016/10/20 全球购物
美国最大的万圣节服装网站:HalloweenCostumes.com
2017/10/12 全球购物
印度尼西亚电子产品购物网站:Kliknklik
2018/06/05 全球购物
客服文员岗位职责
2013/11/29 职场文书
租房协议书怎么写
2014/04/10 职场文书
党员三严三实心得体会
2014/10/13 职场文书
2015年平安创建工作总结
2015/04/29 职场文书
2016基督教会圣诞节开幕词
2016/03/04 职场文书
python基于tkinter制作下班倒计时工具
2021/04/28 Python
JavaScript如何利用Promise控制并发请求个数
2021/05/14 Javascript
详解盒子端CSS动画性能提升
2021/05/24 HTML / CSS