有时候,我们在安装apache+php+mysql时,为了方便,就将已经在其他电脑上安装好环境后的对应文件夹(apache+php+mysql)拷贝到目标电脑上,这个时候一定要注意不仅要修改apache/conf/httpd.conf文件,而且要修改php/php.ini文件


   我以 D:/haofeng/Apache2.2,D:/haofeng/PHP5.2.11为例加以说明:

   1、httpd.conf文件修改:

ServerRoot "D:/haofeng/Apache2.2"

Listen 80

DocumentRoot "D:/haofeng/Apache2.2/www"
<Directory "D:/haofeng/Apache2.2/www">
</Directory>

ScriptAlias /cgi-bin/ "D:/haofeng/Apache2.2/cgi-bin/"
<Directory "D:/haofeng/Apache2.2/cgi-bin">
</Directory>

PHPIniDir "D:/haofeng/PHP5.2.11/"
LoadModule php5_module "D:/haofeng/PHP5.2.11/php5apache2_2.dll"



    2、php.ini文件修改

extension_dir ="D:/haofeng/PHP5.2.11/ext"


最后该配虚拟目录的配虚拟目录,该配置其他端口的配置其他端口;


再贴上cmd安装apache和mysql的命令

=====apache:
D:\haofeng\Apache2.2\bin  
httpd -k install     安装
httpd -k start       启动
httpd -k stop        停止
httpd -k uninstall   卸载

=====mysql:
D:\haofeng\MySQL-5.1.68\bin
mysqld -install    安装
net start mysql    启动
net stop mysql     停止
mysqld -remove     卸载