Soft gadget

Free software and free web resource. Workplace, vitual office and social software links

Thursday, November 17, 2005

php5 + mysql problem solutions

windows XP+Apache+PHP5+MySQL的安装与配置方法在Windows下自己建网站是一件挺不错的事情。由于开源软件的火爆,Apache+php+MySQL成为许多人的首选。可是相比Windows自带的IIS,对于第一次建站的人来说,这些软件复杂的配置往往成为阻碍新手的绊脚石,往往需要阅读大量文档。所以结合自己的经验总结了一个基本的建站步骤。希望对大家有用。 1. 分别下载Apache(http://httpd.apache.org/download.cgi)、php(http://www.php.net/downloads.php)和MySQL(http://dev.mysql.com/downloads/mysql/4.1.html)。 2. 安装MySQL,装好后按照向导进行配置。如果需要用到Fulltext search,将数据库类型设为non transactional。字符集最好设置为标准,即latin1(并不影响中文数据的存储),以免日后转换数据时引起不必要的麻烦。

3. 安装Apache,设置好域名,邮箱,修改httpd.conf里的DocumentRoot和 为网站根路径。注意路径中的斜杠均用正斜杠“/”。

4. 将php5的打包文件解压缩到c:\php下,并将c:\php添加至系统的环境变量path。

5. 将php.ini-recommended更名php.ini并用记事本打开。将其中的extension_dir修改为"c:/php/ext/"。找到;extension=php_mysql.dll一行,将前面的分号(注释)去掉(如果需要用到php的其他模块,也请将相应模块的注释去掉)

In addition to installing MySQL etc. I had to do this to get MySQL to work:1. Make sure that you have a valid php.ini in your windows directory.OR (Per the tut the 'php.ini' can be installed in the 'C:\Program Files\Apache Group\Apache2' folder. This works fine.)

2. copy libmysql.dll to the system32 directory (php_mysql.dll would not load without doing this)3. set the extension_dir in php.ini to the ext directory of your PHP installation directory (like e.g. extension_dir=C:\php5\ext)

4. enable the MySQL extension in php.ini by uncommenting the line extension=php_mysql.dll 5. Restart Apache Server


6. 在httpd.conf里的适当位置添加如下语句

LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "C:/php"

在DirectoryIndex index.html index.html.var后面添加 index.php 7.(可选)在httpd.conf中,将CustomLog "logs/access.log" common修改为CustomLog "bin/rotatelogs.exe -l C:/Progra~1/Apache~1/Apache2/logs/access%Y-%m-%d.log 86400" common这一步的目的是让网站访问日志每天轮转生成新文件,以免文件过大。

8.启动Apache。 9.(可选) 新建phpinfo.php文件,输入并在浏览器中打开,可以检查目前配置的详细信息。

1 Comments:

At 8:25 PM, Blogger Dali said...

In addition to installing MySQL etc. I had to do this to get MySQL to work:

1. Make sure that you have a valid php.ini in your windows directory.
OR (Per the tut the 'php.ini' can be installed in the 'C:\Program Files\Apache Group\Apache2' folder. This works fine.)
2. copy libmysql.dll to the system32 directory (php_mysql.dll would not load without doing this)
3. set the extension_dir in php.ini to the ext directory of your PHP installation directory (like e.g. extension_dir=C:\php5\ext)
4. enable the MySQL extension in php.ini by uncommenting the line extension=php_mysql.dll
5. Restart Apache Server


.

 

Post a Comment

<< Home