分类:
2010-03-08 14:40:22
MySQL下载地址:
PHP下载地址:
1.Mysql的安装(详见LAMP-mysql安装配置文档)
#cd /usr/local/src/tarbag
#wget
#tar zxvf mysql-5.1.36.tar.gz -C ../software
进入mysql解压的源码文件目录
#cd ../software
#./configure --prefix=/usr/local/mysql #设置mysql的安装路径
make && make install #编译,进行安装。
2.Apache的安装,略(详见LAMP-apache安装配置文档)
3、PHP安装
#cd /usr/local/src/tarbag
#wget
#tar zxvf php-5.2.9.tar.gz -C ../software
#cd ../software
#./configure
--prefix=/usr/local/php5
--with-config-file-path=/usr/local/php5
--with-apxs2=/usr/local/apache2/bin/apxs
--with-bz2
--with-curl
--with-curlwrappers
--enable-ftp
--enable-sockets
--disable-ipv6
--with-gd
--with-jpeg-dir=/usr/local
--with-png-dir=/usr/local
--with-freetype-dir=/usr/local
--enable-gd-native-ttf
--with-iconv-dir=/usr/local
--enable-mbstring
--enable-calendar
--with-gettext
--with-libxml-dir=/usr/local
--with-zlib
--enable-zend-multibyte
--with-pdo-mysql=/usr/local/mysql
--with-mysqli=/usr/local/mysql/bin/mysql_config
--with-mysql=/usr/local/mysql
#make && make install #编译,进行安装。
#cp php.ini-dist /usr/local/php/lib/php.ini
在apache2中修改配置文件
#vi /usr/local/apache2/conf/httpd.conf
找到“#AddType application/x-gzip .gz .tgz”
并在后面加入
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
这两行的目的是让apache识别php。
再找到“DirectoryIndex index.html”
加上 index.php 让它把index.php做为默认页
测试环境:
cd /usr/local/httpd/htdocs/
# vi /usr/local/httpd/htdocs/index.php
输入:
phpinfo();
?>
# /usr/local/apache2/bin/apachectl restart 重启apache服务器
例:浏览器中输入:测试一下。如果成功会有相关的php的说明,没成功会提示你保存文件内容。
安装问题:
PHP5.2.10
Make install 时出现:
Fatal error: Error: cannot open phar "/usr/local/src/php-5.2.10/pear/install-pear-nozlib.phar" in /path/php5.2.10/pear/install-pear-nozlib.phar on line 795
make[1]: *** [install-pear-installer] Error 255
make: *** [install-pear] Error 2
解决方法:更换版本
PHP组程序放到150出现问题,类似以下。
全站提示SQLSTATE[HY000] [2002] Invalid argument,类似信息如下:
Fatal error: Uncaught exception 'Zend_Db_Adapter_Exception' with message 'SQLSTATE[HY000] [2002] Invalid argument' in /home/www/private/ZendFramework-1.9.3PL1/library/Zend/Db/Adapter/Pdo/Abstract.php:144
Stack trace:
#0 /home/www/private/ZendFramework-1.9.3PL1/library/Zend/Db/Adapter/Pdo/Mysql.php(96): Zend_Db_Adapter_Pdo_Abstract->_connect()
#1 /home/www/private/ZendFramework-1.9.3PL1/library/Zend/Db/Adapter/Abstract.php(832): Zend_Db_Adapter_Pdo_Mysql->_connect()
#2 /home/www/private/ZendFramework-1.9.3PL1/library/Zend/Db/Adapter/Abstract.php(902): Zend_Db_Adapter_Abstract->quote(1, NULL)
#3 /home/www/private/ZendFramework-1.9.3PL1/library/Zend/Db/Select.php(930): Zend_Db_Adapter_Abstract->quoteInto('SSHY = ?', 1, NULL)
#4 /home/www/private/ZendFramework-1.9.3PL1/library/Zend/Db/Select.php(463): Zend_Db_Select->_where('SSHY = ?', 1, NULL, true)
#5 /home/www/lelaa/app/models/Public/Ticket.php(235): Zend_Db_Select->where('SSHY = ?', 1)
#6 /home/www/lelaa/app/modules/public/controllers/TicketController.php(329): Public_Tic in /home/www/private/ZendFramework-1.9.3PL1/library/Zend/Db/Adapter/Pdo/Abstract.php on line 144
原因求证:php5.3内置驱动有问题。开始使用php5.3内置mysqlnd编译:
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
解决办法:把编译选项改为:
--with-mysql=/path/to/mysql \
--with-pdo-mysql=/path/to/mysql \
--with-mysqli=/path/to/mysql/bin/mysql_config \