日期:2014-05-16  浏览次数:20623 次

linux安装php
tar -zxvf php-5.2.9.tar.gz
cd php-5.2.9

./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/lib --enable-track-vars --with-xml --with-mysql

make
make install

cp php.ini-dist /usr/local/php/lib/php.ini(需要这个?)

以上全都正确后,会自动加入对php模块支持
# vi /usr/local/apache2/conf/httpd.conf
LoadModule php5_module modules/libphp5.so

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

写个phpinfo看看
<?php
phpinfo();
?>

wget http://www.CTOHome.com/linux-vps-pack/zend.sh;sh ./zend.sh;

然后一路YES,OK和回车,安装就完成了。一般来说,不需要另外编辑php.ini文件就可以正常工作了。

卸载php
rpm -qa |grep php

sudo rpm -e php-cli-5.1.6-27.el5_5.3
sudo rpm -e php-5.1.6-27.el5_5.3
sudo rpm -e php-devel-5.1.6-27.el5_5.3
sudo rpm -e php-pdo-5.1.6-27.el5_5.3
sudo rpm -e php-mysql-5.1.6-27.el5_5.3
sudo rpm -e php-xmlrpc-5.1.6-27.el5_5.3
sudo rpm -e php-mbstring-5.1.6-27.el5_5.3
sudo rpm -e php-ldap-5.1.6-27.el5_5.3
sudo rpm -e php-gd-5.1.6-27.el5_5.3
sudo rpm -e php-pear-1.4.9-6.el5
sudo rpm -e php-xml-5.1.6-27.el5_5.3