centos 安装php
1.yum安装
yum install php php-common php-gd php-mcrypt php-pear php-pecl-memcache php-mhash php-mysql php-xml
2.下载编译安装php 5.3.6:
yum install libxml2 libxml2-devel curl curl-devel libjpeg libjpeg-devel libpng libpng-devel libmcrypt libmcrypt-devel libtool-ltdl-devel tar -jxvf php-5.3.6.tar.bz2 cd php-5.3.6 ./configure --prefix=/opt/php -with-apxs2=/opt/httpd/bin/apxs --with-curl --with-mcrypt --enable-mbstring --with-iconv --with-gd -with-jpeg-dir=/usr/local/lib --enable-pdo --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd make make install cp php.ini-development /opt/php/lib/php.ini ln -s /opt/php/bin/php /usr/bin/php vi /opt/php/lib/php.ini 把include_path前面的分号删除,改成include_path = "/opt/php/lib/php" sudo vi /opt/httpd/conf/httpd.conf 在最下面加入一行AddHandler application/x-httpd-php .php sudo /opt/httpd/bin/httpd -k restart sudo vi /opt/httpd/htdocs/phpinfo.php
phpinfo.php的内容如下:
<?php phpinfo(); ?>
安装完php,重启apache,用浏览器访问http://localhost/phpinfo.php,能正常显示说明php装好了。
查看php版本: php -v
参考:http://www.jb51.net/article/24775.htm
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。