search
HomeBackend DevelopmentPHP TutorialWin下配置Apache2,PHP5,MYSQL5,Zend_PHP

Win下配置Apache2,PHP5,MYSQL5,Zend_PHP

Jun 01, 2016 pm 12:30 PM
mysqlInstalldocumentTable of contentsConfiguration

ApacheZendOptimizer

Windows XP下全新安装Apache2,PHP5,MYSQL5,Zend的简单过程
  
  一、下载地址:
  
  Apache2.0.50 :http://httpd.apache.org/download.cgi
  PHP5.0.2 :http://cn2.php.net/get/php-5.0.2-Win32.zip/from/a/mirror
  MYSQL5.0.2:http://dev.mysql.com/downloads/mysql/5.0.html
  Zend2.5.2 :http://www.zend.com/store/free_download.php?pid=13]
  
  软件的安装偶就不说了,其中只有PHP下的是zip包,直接解压就可以了。
  
  安装顺序就是上面列出来的顺序,Zend我是最后等所有的运行都没问题后才装的。
  
  二、简单安装过程:
  
  (一)Apache:
  Apache2.0.50的安装很简单,我就直接把他装到了E盘根目录下(我C盘是系统盘,D盘是temp盘,偶发现在windows下单独拿个分区来做临时文件的存放地对系统的速度影响不小,这样做能提升系统运行的速度,感兴趣的朋友可以试试看),安装完后我的apache目录就是E:\apache2
  
  (二)PHP:
  我是直接解压缩放到E盘php目录下了,这样查找文件会方便许多。
  
  (三)Mysql:
  直接装到E:\mysql下,它的默认目录太长,是在C盘下的,偶的C盘是除windows的文件外别的一概不放的。
  
  (四)Zend:
  所有的调试都正常后我把Zend装到了E:\program files\zend下
  
  三、配置过程:
  
  (一)http.conf
  
  这个文件我改了几个地方:
  把PHP直接作为apache的一个模块运行,我在里面加了两句:
  
  CODE: [Copy to clipboard]
  LoadModule php5_module "E:/php/php5apache2.dll"
  AddType application/x-httpd-php .php
  
  我在E:\apache2目录下建立了一个www的目录用于存放我的站点文件,在http.conf里改了这样一句话:
  把DocumentRoot "E:/Apache2/htdocs"改成了DocumentRoot "E:/Apache2/www"
  
  Apache2.0.x于1.3.x相比2.0.x默认不能直接列目录,偶感觉不爽,就改了:
  把DocumentRoot "E:/Apache2/www"这句下的如下语句
  
  CODE: [Copy to clipboard]
  
  Options FollowSymLinks
  AllowOverride None
  
  改为:
  
  CODE: [Copy to clipboard]
  
  Options Indexes FollowSymLinks
  AllowOverride None
  
  把apache的默认字符设置为中文简体:
  AddDefaultCharset GB2312
  
  修改目录的默认首页:
  DirectoryIndex 后面写上你想设置为首页的文件名,如:index.html index.php等
  
  别的就没再动什么地方
  
  注意一点的是,要使这些配置生效需要重新启动apache
  
  (二)php.ini
  
  以前用php4.x的时候觉得配置起来很简单,所以偶用PHP5也直接那么配了,谁知道完了mysql不能用,说是无法连接动态库,我仔细检查了一下 php_mysql.dll明明存在,可就说找不到,这点让我郁闷了N久,偶重新解压了php5也没用,后来在php的install文档里发现了这么一句话: php_mysql.dll MySQL functions PHP >= 5.0.0, requires libmysql.dll  (bundled)
  
  于是偶才找到了原因......
  
  配置php5.0.2是这样来过的:
  
  把php.ini-dist复制到C:\windows 下改名为 php.ini(装过php的都做过吧)
  
  然后修改了几个地方:
  extension_dir = "E:\php\ext" (指定动态连接库的目录,php5和php4不同的地方就是它的动态连接库目录变了,这在它的文档结构里有详细的说明)
  
  然后把下面几句前面的分号去掉
  ;extension=php_dba.dll
  ;extension=php_dbase.dll
  ;extension=php_filepro.dll
  ;extension=php_gd2.dll
  ;extension=php_imap.dll
  ;extension=php_mysql.dll
  
  接下来修改了一些文件上传以及内存使用最大限制:
  memory_limit = 20M
  post_max_size = 20M
  upload_max_filesize = 20M
  
  别的就没改什么了,这里修改过php.ini以后也要重新启动apache
  
  接下来一点很重要的就是把php目录下的 libmysql.dll 和 libmysqli.dll 复制到windows/system32下,如果不这样做,mysql动态连接库就无法正常加载。
  
  (三)Mysql和Zend的配置
  
  现在Apache和PHP都已经配置好了,在浏览器里输入localhost看看结果,运行成功,然后输入localhost/phpmyadmin看也成功。郁闷,Phpmyadmin提示错误信息:
  
  QUOTE:
  MySQL 返回:
  
  #1251 - Client does not support authentication protocol requested by server; consider upgrading MySQL client
  
  奇怪了,偶明明装的是MYSQL最新版本怎么会客户端版本过低呢,真是郁闷啊
  
  就此放了一下,经多次测试仍然不成功就先放弃了一下,玩了一把KOF97
  
  然后在CCF.熊猫和IM286.ceo的帮助下,终于找到了原因:
  
  落伍ceo:“升级客户端
  
  新版本的mysql使用了新的密码验证方法
  
  设置mysql密码时使用old_password可以解决这个问题”
  
  CCF.熊猫:“使用old_password”重新设定密码就可以了”。
  
  感谢这两位朋友,具体解决办法如下:
  
  由于偶不知道怎么升级client,因为在windows 下 server和client是捆绑安装的,我就用了old_password的方法:
  
  QUOTE:
  mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('newpwd')
  -> WHERE Host = 'some_host' AND User = 'some_user';
  mysql> FLUSH PRIVILEGES;
  
  然后浏览“http://localhost/phpmyadmin”,OH YEAH! 测试成功!
Statement
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
PHP Performance Tuning for High Traffic WebsitesPHP Performance Tuning for High Traffic WebsitesMay 14, 2025 am 12:13 AM

ThesecrettokeepingaPHP-poweredwebsiterunningsmoothlyunderheavyloadinvolvesseveralkeystrategies:1)ImplementopcodecachingwithOPcachetoreducescriptexecutiontime,2)UsedatabasequerycachingwithRedistolessendatabaseload,3)LeverageCDNslikeCloudflareforservin

Dependency Injection in PHP: Code Examples for BeginnersDependency Injection in PHP: Code Examples for BeginnersMay 14, 2025 am 12:08 AM

You should care about DependencyInjection(DI) because it makes your code clearer and easier to maintain. 1) DI makes it more modular by decoupling classes, 2) improves the convenience of testing and code flexibility, 3) Use DI containers to manage complex dependencies, but pay attention to performance impact and circular dependencies, 4) The best practice is to rely on abstract interfaces to achieve loose coupling.

PHP Performance: is it possible to optimize the application?PHP Performance: is it possible to optimize the application?May 14, 2025 am 12:04 AM

Yes,optimizingaPHPapplicationispossibleandessential.1)ImplementcachingusingAPCutoreducedatabaseload.2)Optimizedatabaseswithindexing,efficientqueries,andconnectionpooling.3)Enhancecodewithbuilt-infunctions,avoidingglobalvariables,andusingopcodecaching

PHP Performance Optimization: The Ultimate GuidePHP Performance Optimization: The Ultimate GuideMay 14, 2025 am 12:02 AM

ThekeystrategiestosignificantlyboostPHPapplicationperformanceare:1)UseopcodecachinglikeOPcachetoreduceexecutiontime,2)Optimizedatabaseinteractionswithpreparedstatementsandproperindexing,3)ConfigurewebserverslikeNginxwithPHP-FPMforbetterperformance,4)

PHP Dependency Injection Container: A Quick StartPHP Dependency Injection Container: A Quick StartMay 13, 2025 am 12:11 AM

APHPDependencyInjectionContainerisatoolthatmanagesclassdependencies,enhancingcodemodularity,testability,andmaintainability.Itactsasacentralhubforcreatingandinjectingdependencies,thusreducingtightcouplingandeasingunittesting.

Dependency Injection vs. Service Locator in PHPDependency Injection vs. Service Locator in PHPMay 13, 2025 am 12:10 AM

Select DependencyInjection (DI) for large applications, ServiceLocator is suitable for small projects or prototypes. 1) DI improves the testability and modularity of the code through constructor injection. 2) ServiceLocator obtains services through center registration, which is convenient but may lead to an increase in code coupling.

PHP performance optimization strategies.PHP performance optimization strategies.May 13, 2025 am 12:06 AM

PHPapplicationscanbeoptimizedforspeedandefficiencyby:1)enablingopcacheinphp.ini,2)usingpreparedstatementswithPDOfordatabasequeries,3)replacingloopswitharray_filterandarray_mapfordataprocessing,4)configuringNginxasareverseproxy,5)implementingcachingwi

PHP Email Validation: Ensuring Emails Are Sent CorrectlyPHP Email Validation: Ensuring Emails Are Sent CorrectlyMay 13, 2025 am 12:06 AM

PHPemailvalidationinvolvesthreesteps:1)Formatvalidationusingregularexpressionstochecktheemailformat;2)DNSvalidationtoensurethedomainhasavalidMXrecord;3)SMTPvalidation,themostthoroughmethod,whichchecksifthemailboxexistsbyconnectingtotheSMTPserver.Impl

See all articles

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 Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),