Apache + PHP + MySQL Envirornment Installation(20091225日之后不再更新,已放入我的google文档中)

本文详细介绍了如何在本地计算机上安装配置LAMP(Linux/Apache/MySQL/PHP)环境的过程,包括解决常见问题的方法。从Apache服务器的安装到更改监听端口,再到MySQL和PHP的安装配置,以及最后phpMyAdmin的部署。

Envirornment installing

1、  Install Apache

a)         If the port is being using by another web server or something, you can go the directory of the install directory of Apache and find&open the file “httpd.conf” in subdir “conf”, then find the words “Listen 80” without prefix “#”, and replace the port 80 to some other number, say 66.And then you can check if it works with url http://127.0.0.1:66.

2、  Install MySQL

a)         Just install it.

b)         If you wanna inport some databases or tables you can put the sql scripts into the subdir “./bin” for a while, and goto the subdir “./bin” in the command line window, then run the command like this “mysql –u root < yoursqlscript.sql”.

c)

3、  Install PHP

a)         The suggestion is that you should install php with zip file:

                         i.              Unzip the file into some place you like, say “c:/php5”

                       ii.              To allow Apache server know how to explain php files and run as a module mode with php, you should go to the subdir “./conf” of Apache install directory and add 2 lines below at the end of the file “httpd.conf”:(And accordding to my experiences, you should absolutely point a full path name here, otherwise there will be only god knows problems.And by the way, you should need to know how to check "error.log" file in "./log" subdir to find out what's exactly going on with Apache server's starting.)

LoadModule php5_module "c:/php5/php5apache2_2.dll"

AddType application/x-httpd-php .php

PHPINIDir "c:/php5"

                      iii.              To allow Apache&PHP work with MySQL:first of all, you should copy all the dll files in “c:/php5” without prefix “php_” into the “c:/windows/system32” directory(Because that some extension dlls the php will load are relied on them)., second of all, you should find the line like this “;extension=php_mysql.dll”, and then get rid of “;”.But you will notice that the file “php_mysql.dll” is actually in the subdir “./ext”, so you should keep dig the “extension_dir =” line out and change it into this one “extension_dir = c:/php5/ext”.And you maybe need to unrim the following lines:"extension=php_gd2.dll"(for graphic handling of php), "extension=php_mcrypt.dll"(for phpmyadmin for some reason), "extension=php_mysql.dll" and so on and on...:)

                      iv.              And above all, you should load some extension dlls like “php_gd2.dll”(for validation code function), “php_mcrypt.dll” and so on.

                       v.              Restart Apache server and then try to make a “test.php” like the above and see if it works.If it works, you should see a web page like this:

b)         Go to the subdir “htdocs” of Apache and create a file named “test.php”, the whole content is like this:

<html>

<head></head>

<title>The 1st php pageO(_)O~</title>

<body>

<?php

phpinfo();

?>

</body>

</html>

Then try to browse http://127.0.0.1:66/test.php, see if it works.

                         i.              And if it works with MySQL, the page will include content like this:

 

                       ii.              And if the configuration of MySQL in php.ini is all right, you should see some “mysql” lines in the page like this:

 

c)          

4、  Install phpMyAdmin

a)         Unzip the zip file to the subdir of Apache “./htdocs”, and hold all the files in the path like this “./htdocs/phpMyAdmin-3.2.4”.

b)         Copy the file “config.sample.inc.php” to “config.inc.php”, and open the “config.inc.php”.

c)         Goto the subdir “./libraries” open the file “config.default.php”, find the line with “$cfg['Servers'][$i]['port'] =” and add the exactly port of the MySQL server, say 3366 here, it will be like this:“$cfg['Servers'][$i]['port'] = ‘3366’”;

d)         Goto the directory of PHP, and open the file “php.ini”, find the line with “;extension=php_mcrypt.dl” and chage it to “extension=./ext/php_mcrypt.dl”;

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值