Discuz教程网

php开发环境配置记录

[复制链接]
authicon 09927306 发表于 2011-1-15 12:49:59 | 显示全部楼层 |阅读模式
【apache安装】

  1. httpd.exe -k install -n "apache2.2.15"
  2. httpd.exe -k start -n "apache2.2.15"
复制代码

【apache卸载】

  1. httpd.exe -k stop -n "apache2.2.15"
  2. httpd.exe -k uninstall -n "apache2.2.15"
复制代码

【httpd.conf配置关键】

  1. ServerRoot "D:/APM/Apache2.2.15"
  2. Listen 80
  3. # 压缩发送给客户端的内容 gzip支持
  4. #LoadModule deflate_module modules/mod_deflate.so
  5. # LoadModule cgi_module modules/mod_cgi.so
  6. # fastcgi
  7. LoadModule fcgid_module modules/mod_fcgid.so
  8. LoadModule rewrite_module modules/mod_rewrite.so
  9. DocumentRoot "D:/APM/Apache2.2.15/htdocs"
  10. # 支持 php 脚本
  11. # fastcgi模式将此行注释
  12. # 直接在虚拟主机中可配置每个站点使用不同版本的php 或者不同的cgi
  13. #Include conf/extra/httpd-php.conf
  14. # Fancy directory listings 华丽的目录清单
  15. Include conf/extra/httpd-autoindex.conf
  16. # Virtual hosts 虚拟主机
  17. #Include conf/extra/httpd-vhosts.conf
  18. # fastcgi模式虚拟主机
  19. Include conf/extra/httpd-vhosts-fcgid.conf
  20. # Various default settings 页脚显示版本信息AccessFileName .htaccess
  21. Include conf/extra/httpd-default.conf
复制代码

【httpd-php.conf参考】

  1. #
  2. # 查找 /APM/php-5.2.12-Win32 替换
  3. #
  4. SetEnv PHPRC "/APM/php-5.2.12-Win32"
  5. SetEnv TMP "/tmp"
  6. # UnsetEnv PERL5LIB
  7. # 加载dll省去在PATH中添加php路径
  8. #LoadFile "/APM/php-5.2.12-Win32/libpq.dll"
  9. LoadFile "/APM/php-5.2.12-Win32/libmysql.dll"
  10. LoadFile "/APM/php-5.2.12-Win32/libmcrypt.dll"
  11. LoadFile "/APM/php-5.2.12-Win32/libmhash.dll"
  12. LoadFile "/APM/php-5.2.12-Win32/libeay32.dll"
  13. LoadFile /APM/php-5.2.12-Win32/ssleay32.dll
  14. #
  15. # PHP-Module setup
  16. #
  17. LoadFile "/APM/php-5.2.12-Win32/php5ts.dll"
  18. LoadModule php5_module "/APM/php-5.2.12-Win32/php5apache2_2.dll"
  19. SetHandler application/x-httpd-php
  20. SetHandler application/x-httpd-php-source
  21. # Load php.ini File Dir
  22. PHPIniDir "/APM/php-5.2.12-Win32"
  23. AddType text/html .php .phps
复制代码

【httpd-vhosts.conf参考】

  1. NameVirtualHost *:80
  2. #文档目录
  3. DocumentRoot "/vhosts/localhost"
  4. #名字 如www.php.net
  5. ServerName localhost
  6. #别名 如php.net
  7. ServerAlias 127.0.0.1
  8. #错误日志文件
  9. ErrorLog "logs/dummy-host.localhost-error_log"
  10. #目录访问规则
  11. Options Indexes FollowSymLinks
  12. AllowOverride All
  13. Order allow,deny
  14. Allow from all
  15. #目录索引文件
  16. DirectoryIndex index.html index.htm index.php
  17. [html]
复制代码

【httpd-vhosts-fcgid.conf参考】

  1. #FcgidInitialEnv PHPRC "/APM/php5210"
  2. #FcgidInitialEnv PATH "/APM/php5210;C:/WINDOWS/system32;C:/WINDOWS;C:/WINDOWS/System32/Wbem;"
  3. #FcgidInitialEnv SystemRoot "C:/Windows"
  4. #FcgidInitialEnv SystemDrive "C:"
  5. #FcgidInitialEnv TEMP "C:/WINDOWS/Temp"
  6. #FcgidInitialEnv TMP "C:/WINDOWS/Temp"
  7. #FcgidInitialEnv windir "C:/WINDOWS"
  8. FcgidIOTimeout 64
  9. FcgidConnectTimeout 16
  10. FcgidMaxRequestsPerProcess 500
  11. NameVirtualHost *:80
  12. DocumentRoot "/vhosts/localhost"
  13. ServerName localhost
  14. ServerAlias 127.0.0.1
  15. ErrorLog "logs/dummy-host.localhost-error_log"
  16. Options Indexes FollowSymLinks ExecCGI
  17. #Options +ExecCGI
  18. AllowOverride All
  19. #AddHandler fcgid-script .php
  20. #FCGIWrapper /APM/php5210/php-cgi.exe .php
  21. #"
  22. AddHandler fcgid-script .php
  23. FcgidWrapper "/APM/php-5.2.13-nts-Win32/php-cgi.exe" .php
  24. #FcgidWrapper "/APM/php-5.3.2-nts-Win32-VC6-x86/php-cgi.exe" .php
  25. #
  26. Order allow,deny
  27. Allow from all
  28. DirectoryIndex index.html index.htm index.php
复制代码

【Mysql安装】

  1. mysqld-nt.exe --install MySQL5.0.45-community-nt --defaults-file=D:\\APM\\mysql5.0.45\\my.ini
  2. net start MySQL5.0.45-community-nt
复制代码

【Mysql卸载】

  1. net stop MySQL5.0.45-community-nt
  2. mysqld-nt.exe --remove MySQL5.0.45-community-nt
复制代码

【my.ini参考】

  1. [mysqld]
  2. basedir="D:\\APM\\mysql5.0.45\\"
  3. datadir="D:\\APM\\mysql5.0.45\\Data\\"
  4. tmpdir="D:\\APM\\mysql5.0.45\\tmp\\"
  5. # log="D:\\APM\\mysql5.0.45\\tmp\\mysql.log"
  6. default-character-set=utf8
  7. port=3306
  8. interactive_timeout=5
  9. wait_timeout=5
  10. skip-locking
  11. skip-innodb
  12. skip-bdb
  13. ft_min_word_len=1
  14. [mysqld]
  15. port=3306
  16. basedir="D:/mysql/"
  17. datadir="D:/mysql/Data/"
  18. tmpdir="d:/mysql/tmp/"
  19. default-character-set=utf8
  20. default-storage-engine=MYISAM
  21. skip-bdb
  22. skip-innodb
  23. skip-locking
  24. key_buffer=16M
  25. max_allowed_packet=1M
  26. table_cache=128
  27. thread_cache=8
  28. join_buffer_size=512K
  29. sort_buffer=512K
  30. record_buffer=512K
  31. max_connections=500
  32. wait_timeout=120
  33. interactive_timeout=120
  34. max_connect_errors=3000
  35. long_query_time=1
  36. max_heap_table_size=16M
  37. tmp_table_size=8M
  38. thread_concurrency=8
  39. myisam_sort_buffer_size=8M
  40. myisam_sort_buffer_size=4M
  41. low_priority_updates=1
  42. ft_min_word_len=1
复制代码

【php.ini配置参考】

  1. output_buffering = On
  2. disable_functions = system,passthru,shell_exec,exec,popen,proc_open
  3. enable_dl = Off

  4. upload_tmp_dir = "D:/tmp/uploadtemp/"
  5. session.save_path = "d:/tmp/sessiondata/"
  6. date.timezone = "Etc/GMT-8" ;表示的是 GMT+8
  7. mbstring.language = Neutral ; Set default language to Neutral(UTF-8) (default)
  8. mbstring.internal_encoding = UTF-8 ; Set internal encoding to UTF-8

  9. cgi.force_redirect = 0
  10. cgi.fix_pathinfo = 1
  11. fastcgi.impersonate = 1

  12. [eaccelerator]
  13. ;zend_extension="/APM/ext/eAccelerator_v0_9_6_for_v5_2_13-VC6/eAccelerator.dll"
  14. ;zend_extension="/APM/ext/eAccelerator_v1_0_svn412_for_v5_2_13-VC6/eAccelerator.dll"
  15. eaccelerator.shm_size="16"
  16. eaccelerator.cache_dir="/tmp/eaccelerator"
  17. eaccelerator.enable="1"
  18. eaccelerator.optimizer="1"
  19. eaccelerator.check_mtime="1"
  20. eaccelerator.debug="0"
  21. ;eaccelerator.log_file="/var/log/httpd/eaccelerator_log"
  22. eaccelerator.filter=""
  23. eaccelerator.shm_max="0"
  24. eaccelerator.shm_ttl="300"
  25. eaccelerator.shm_prune_period="0"
  26. eaccelerator.shm_only="0"
  27. eaccelerator.compress="1"
  28. eaccelerator.compress_level="9"

  29. [Zend]
  30. zend_optimizer.optimization_level=15
  31. zend_optimizer.encoder_loader=0
  32. ;zend_extension_ts="/APM/ext/ZendOptimizer-3.3.0/lib/Optimizer-3.3.0/php-5.2.x/ZendOptimizer.dll"
  33. ;zend_extension="/APM/ext/ZendOptimizer_nts.dll"
  34. ;zend_extension="/APM/ext/ZendOptimizerPlus.dll"

  35. ; 下面是使用ZendExtensionManager.dll的参考配置
  36. ;zend_extension_manager.optimizer_ts="/APM/Zend/ZendOptimizer-3.3.0/lib/Optimizer-3.3.0"
  37. ;zend_extension_ts="/APM/Zend/ZendOptimizer-3.3.0/lib/ZendExtensionManager.dll"
  38. ;zend_extension_manager.debug_server_ts="/APM/Zend/ZendOptimizer-3.3.0/lib/ZendDebugger-5.2.13-cygwin_nt-i386"
  39. ;zend_debugger.expose_remotely=always
  40. ;zend_debugger.allow_hosts=127.0.0.1/32
  41. ;zend_debugger.allow_tunnel=127.0.0.1/32
  42. [ZendDebugger]
  43. ; 放到后边可以和zend_optimizer同时加载
  44. ;zend_extension_ts="/APM/ext/ZendDebugger-5.2.15RC1-cygwin_nt-i386/php-5.2.x/ZendDebugger.dll"

  45. [xcache-common]
  46. ;zend_extension="D:/APM/ext/XCache-1.3.0-php-5.2.10-nts-Win32-VC6-x86/php_xcache.dll"
  47. ; extension = php_xcache.dll

  48. [xcache.admin]
  49. xcache.admin.enable_auth = Off
  50. xcache.admin.user = "mOo"
  51. ; xcache.admin.pass = md5($您的密码)
  52. xcache.admin.pass = ""

  53. [xcache]
  54. ; 这里的多数选项仅在 ini 里可以修改, 这里列出的都是默认值, 除非另外说明
  55. ; select low level shm/allocator scheme implemenation
  56. xcache.shm_scheme = "mmap"
  57. ; 禁用: xcache.size=0
  58. ; 启用: xcache.size=64M 之类 (任意>0的值) 同时请注意您的系统 mmap 上限
  59. xcache.size = 0
  60. ; 建议设置为 cpu 数 (cat /proc/cpuinfo |grep -c processor)
  61. xcache.count = 1
  62. ; 只是个参考值, 您可以放心地存储多于此数量的项目(php脚本/变量)
  63. xcache.slots = 8K
  64. ; 缓存项目的 ttl, 0=永久
  65. xcache.ttl = 0
  66. ; 扫描过期项目的时间间隔, 0=不扫描, 其他值以秒为单位
  67. xcache.gc_interval = 60

  68. ; 同上, 只是针对变量缓存设置
  69. xcache.var_size = 1M
  70. xcache.var_count = 1
  71. xcache.var_slots = 8K
  72. ; 默认, 允许 ini_set()
  73. xcache.var_ttl = 0
  74. ; 最大ttl值
  75. xcache.var_maxttl = 0
  76. xcache.var_gc_interval = 300

  77. ; 仅测试用
  78. xcache.test = Off
  79. ; /dev/zero 时无效
  80. xcache.readonly_protection = Off
  81. ; 对于 *nix 系统, xcache.mmap_path 是文件路径而不是目录, (可以不存在 但是必须能创建).
  82. ; 如果您期望启用 ReadonlyProtection, 可以使用类似 "/tmp/xcache"
  83. ; 2 个 php 组不会共享同一个 /tmp/xcache
  84. ; 对于 Win32 系统, xcache.mmap_path=匿名MAP名字, 不是文件路径. 建议使用 XCache 字眼避免跟其他软件冲突
  85. xcache.mmap_path = "XCache"

  86. ; 仅用于 *nix 系统
  87. ; 设置为空(禁用) 或者类似 "/tmp/phpcore/"
  88. ; 注意该目录应该能被 php 写入文件 (跟 open_basedir 无关)
  89. xcache.coredump_directory = ""

  90. xcache.cacher = On
  91. xcache.stat = On
  92. xcache.optimizer = Off

  93. [xcache.coverager]

  94. ; 如果 xcache.coveragedump_directory 设置为空则本设置自动为 Off
  95. xcache.coverager = Off

  96. ; 请确保本目录能被 coverage viewer 脚本读取 (注意 open_basedir)
  97. ; 依赖于 xcache.coverager=On
  98. xcache.coveragedump_directory = ""

  99. [Xdebug]
  100. xdebug.var_display_max_depth = 10
  101. ;xdebug.remote_autostart = 1
  102. ;xdebug.remote_enable=1
  103. ;xdebug.remote_handler=dbgp
  104. ;xdebug.remote_host=127.0.0.1
  105. ;xdebug.remote_mode=req
  106. ;xdebug.idekey=default
  107. ;xdebug.remote_log="/xdebug.log"
  108. ;xdebug.remote_port=9000
  109. xdebug.auto_trace=off
  110. ;xdebug.collect_params=on
  111. ;xdebug.collect_return=on
  112. xdebug.trace_output_dir="/tmp/xdebug"
  113. xdebug.profiler_enable=off
  114. xdebug.profiler_output_dir="/tmp/xdebug"
  115. ;zend_extension_ts="/APM/ext/xdebug/php_xdebug-2.0.5-5.2.dll"
  116. ;zend_extension="/APM/ext/xdebug/php_xdebug-2.0.5-5.2-nts.dll"
  117. zend_extension="/APM/ext/xdebug/php_xdebug-2.1.0beta3-5.2-vc6-nts.dll"
复制代码

【IIS ISAPI】

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

【IIS FastCGI PHP】

  1. 这个不用添加环境变量和修改PATH变量。
  2. 先安装FastCGI,安装程序会自动添加
  3. Web 服务扩展 - FastCGI Handler
  4. c:\\windows\\system32\\inetsrv\\fcgiext.dll
  5. 并设置为允许。
  6. 修改c:\\windows\\system32\\inetsrv\\fcgiext.ini
  7. [Types]
  8. php=PHP
  9. [PHP]
  10. ExePath=D:\\php\\php-cgi.exe
  11. InstanceMaxRequests=10000
  12. EnvironmentVars=PHP_FCGI_MAX_REQUESTS:10000
  13. 添加应用程序扩展名映射 可执行文件 c:\\windows\\system32\\inetsrv\\fcgiext.dll 扩展名.php
  14. 重启iis就行了。
复制代码

【ISAPI_Rewrite 参考】

  1. RewriteEngine On
  2. RewriteBase /

  3. RewriteCond %{HTTP_HOST} ^03188.net [NC]
  4. RewriteRule ^(.*)$ http://www.03188.net/$1 [L,R=301]

  5. #### RewriteCond %{REQUEST_URI} ^[A-Z]{3,9}\\ /index\\.php\\ HTTP /
  6. # RewriteRule ^index\\.(php|htm|html)$ http://www.03188.net/ [R=301,L]

  7. RewriteRule ^([a-z]+)/(.*)/(.*)/(.*)\\.htm$ index.php?action=$1&option=$2&extent=$3&info=$4 [L]
  8. RewriteRule ^([a-z]+)/(.*)/(.*)\\.htm$ index.php?action=$1&option=$2&extent=$3&info=$3 [L]
  9. RewriteRule ^([a-z]+)/(.*)\\.htm$ index.php?action=$1&option=$2 [L]
  10. RewriteRule ^([a-z]+)\\.htm$ index.php?action=$1 [L]

  11. # RewriteRule ^(.*)\\.asp$ http://www.03188.net [L,R=301]
  12. # 修改完整模式下被抓取的url使有效
  13. # RewriteRule ^index\\.php/([a-z]+)/(.*)/(.*)\\.htm$ $1/$2/$3\\.htm [L,R=301]
  14. # RewriteRule ^index\\.php/([a-z]+)/(.*)\\.htm$ $1/$2\\.htm [L,R=301]

  15. # 修改论坛移动后出现No input file specified.
  16. # RewriteRule ^bbs/(.*)$ http://bbs.03188.net/$1 [L,R=301]

  17. # 修改人力资源hr
  18. # RewriteRule ^hr/(.*)$ http://hr.03188.net/$1 [L,R=301]
复制代码




上一篇:杭州电子科技大学数据结构考试卷(A)卷
下一篇:PHP初学者头疼问题总结
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

1314学习网 ( 浙ICP备10214163号 )

GMT+8, 2025-5-14 15:29

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表