./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-apxs2=/usr/local/apache2/bin/apxs --with-MySQL=/usr/local/mysql/ --with-libxml-dir=/usr/local/libxml2/ --with-png-dir=/usr/local/libpng/ --with-jpeg-dir=/usr/local/jpeg6/ --with-freetype-dir=/usr/local/freetype/ --with-gd=/usr/local/gd2/ --with-zlib-dir=/usr/local/zlib/ --with-mcrypt=/usr/local/libmcrypt/ --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-soap --enable-mbstring=all --enable-sockets
make && make install
B.生成配置文件
cp php.ini-development /usr/local/php/etc/php.ini
C.配置
vim /etc/httpd/httpd.conf
添加下面代码
<IfModule mod_php5.c>
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php .phtml .php3
AddType application/x-httpd-php-source .phps
</IfModule>
重启apache
#/usr/local/apache2/bin/apachectl restart
C.遇到错误
#/usr/local/apache2/bin/apachectl restart
a.httpd: Syntax error on line 57 of /etc/httpd/httpd.conf: Cannot load /usr/local/apache2/modules/libphp5.so into server: /usr/local/apache2/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied
原因:是Linux有一个SELinux保护模式引起的。
解决办法:
关闭SELINUX的方法:
vi /etc/selinux/config 将SELINUX=enforcing 改成SELINUX=disabled 需要重启 :
b.设置php.ini时区
<?
phpinfo();
?>
报错:
Warning: phpinfo() [function.phpinfo]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing' for 'CST/8.0/no DST' instead in /usr/local/apache2/htdocs/test.php on line 2
解决方法:
在php.ini中设置date.timezone的值为PRC,设置好以后的为:date.timezone=PRC,同时取消这一行代码的注释,即去掉前面的分号就可以了。
(12)安装phpmyadmin
cp -a phpMyAdmin-3.3.8.1-all-languages /usr/local/apache2/htdocs/phpmyadmin
cd /usr/local/apache2/htdocs/phpmyadmin/
cp config.sample.inc.php config.inc.php
打开浏览器,在地址栏里输入: