Linux学习总结(三十二)lamp之php安装
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux学习总结(三十二)lamp之php安装相关的知识,希望对你有一定的参考价值。
php官网www.php.net
当前主流版本为5.6/7.1
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.4/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-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif
下面开始漫长的排错过程
yum provides xml2-config
yum install -y libxml2-devel
yum list |grep -i openssl
yum install -y openssl openssl-devel
yum install -y bzip2-devel
yum install -y libjpeg-devel
yum install -y libpng-devel
yum install -y freetype-devel
yum install -y epel-release
yum install -y libmcrypt-devel
继续./configure ...
make && make install
cp php.ini-production /usr/local/php/etc/php.ini //拷贝配置文件
安装完成后我们找下看是否生成了我们要的php模块libphp5.so
ls /usr/local/apache2.4/modules/libphp5.so 可以找到
du -sh !$ 查看下它的大小 ,发现36M左右
至此说明我们php安装成功了
php7 安装
方法跟php5相同,就是./configure 时改下安装路径,和配置文件路径
cd /usr/local/src/
wget http://cn2.php.net/distributions/php-7.1.6.tar.bz2
tar zxf php-7.1.6.tar.bz2
cd php-7.1.6
./configure --prefix=/usr/local/php7 --with-apxs2=/usr/local/apache2.4/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/libphp*
cp php.ini-production /usr/local/php7/etc/php.ini
最后我们把要下载的包总结下:
yum install -y libxml2-devel
yum install -y openssl openssl-devel
yum install -y bzip2-devel
yum install -y libjpeg-devel
yum install -y libpng-devel
yum install -y freetype-devel
yum install -y epel-release
yum install -y libmcrypt-devel
以上是关于Linux学习总结(三十二)lamp之php安装的主要内容,如果未能解决你的问题,请参考以下文章
Linux学习总结(三十七)lamp之禁止php解析 user_agent 访问控制 php相关配置
Linux学习总结(三十一)lamp之mariadb apache 安装