11月13日任务
11.10/11.11/11.12 安装PHP5
11.13 安装PHP71.安装PHP5
- PHP官网www.php.net 当前主流版本为5.6/7.1
- 先安装下面这些包,避免缺少包而重复安装操作
yum install -y libxml2-devel
yum install -y libpng-devel yum install -y openssl yum install -y openssl-devel yum install -y bzip2 yum install -y bzip2-devel yum install -y libjpeg-devel yum install -y freetype-devel yum install -y libmcrypt.x86_64 yum install -y libmcrypt-devel.x86_64- cd /usr/local/src/
- wget http://cn2.php.net/distributions/php-5.6.30.tar.gz
- tar zxf php-5.6.30.tar.gz
- cd php-5.6.30
- ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/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-penssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif
- make && make install
- cp php.ini-production /usr/local/php/etc/php.ini
同安装mysql大同小异,主要是解决编译时候出现的问题,多做几遍,网上查阅资料。
2.安装PHP7
- cd /usr/local/src/
- wget http://cn2.php.net/distributions/php-7.1.6.tar.bz2
- tar jxvf php-7.1.6.tar.bz2
- cd php-7.1.6
- ./configure --prefix=/usr/local/php7 --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php7/etc --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/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
- make && make install
- ls /usr/local/apache2.4/modules/libphp7.so
- cp php.ini-production /usr/local/php7/etc/php.ini
- 编辑Apache配置文件,可以更换要使用的PHP
- vim /usr/local/apache2/conf/httpd.conf