码迷,mamicode.com
首页 > Web开发 > 详细

centos 安装php

时间:2015-04-22 13:21:15      阅读:162      评论:0      收藏:0      [点我收藏+]

标签:

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:

http://php.net/downloads.php

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

centos 安装php

标签:

原文地址:http://www.cnblogs.com/qingyizhishi/p/4446881.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!