PHP的安装

1、PHP5的安装:

下载:

wget -c http://cn2.php.net/distributions/php-5.6.36.tar.gz  (php5)

wget -c http://cn2.php.net/distributions/php-7.2.5.tar.gz   (php7)

解压:

 tar -xvf php-5.6.36.tar.gz

 tar -xvf php-7.2.5.tar.gz

进入到解压后的目录里面去:

cd php-5.6.36

安装:

./configure --prefix=/usr/local/php56 --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php/etc  --with-mysql=/usr/local/mysql56 --with-pdo-mysql=/usr/local/mysql56 --with-mysqli=/usr/local/mysql56/bin/mysql_config --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif

   若出现这些报错:

yum install bzip2-devel.x86_64 -y

yum install openssl-devel.x86_64 -y

yum install libxml2-devel.x86_64 -y

yum install libjpeg-turbo-devel.x86_64 libjpeg-turbo.x86_64  -y

yum install libpng-devel.x86_64 libpng.x86_64 libpng12.x86_64 libpng12-devel.x86_64 -y

yum install freetype-devel.x86_64 -y

yum install libmcrypt.x86_64 libmcrypt-devel.x86_64 -y

make &&  make install  编译并安装。

 查看PHP 所加载的模块:

/usr/local/php56/bin/php -m

 查看apache 所加载的模块:

因为php做为apache的一个模块而调用的,所以,想看php启动成功没,就看apache是否有调用。

/usr/local/apache2.4/bin/apachectl -M

 查看apache配制文件中是否有加载PHP模块:

cat  /usr/local/apache2.4/conf/httpd.conf |grep -i PHP

互此php5模块,安装成功!

2、PHP7的安装:

猜你喜欢

转载自www.cnblogs.com/nfyx/p/9086038.html