为什么80%的码农都做不了架构师?>>>
PHP5安装
- 下载
wget http://cn2.php.net/distributions/php-5.6.32.tar.bz2
- 解压
提示:无法 exec: 没有那个文件或目录
原因是缺少bzip2包
yum install -y bzip2
解压
tar -jxvf php-5.6.32.tar.bz2
- 配置
1. 需要先安装xml2
yum install -y libxml2-devel
2 需要安装openssl
yum install -y openssl-devel
3 需要安装bzip2
yum install -y bzip2-devel
4.需要安装libjpeg-turbo-devel
yum install -y libjpeg-turbo-devel
5. 需要安装libpng-devel
yum install -y libpng-devel
6. 需要安装libmcrypt-devel
* 因为yum不带此源,需要先安装
yum install -y epel-release
yum install -y libmcrypt-devel
./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
此处如果需要配置mariadb的话也可以
./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/mariadb --with-pdo-mysql=/usr/local/mariadb --with-mysqli=/usr/local/mariadb/bin/mariadb_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
- prefix : 安装目录
- with-apxs2 : apache自动管理扩展模块
- with-config-file : apache自动管理模块配置文件路径
- with-mysql、with-pdo-mysql、with-mysqli : php连接mysql驱动
提示报错:freetype-config not found
yum install freetype-devel
- 安装
make && make install
- 复制配置文件到
- 配置文件解释
- php.ini-production 生产环境文件
- php.ini-development开发测试环境
cp php.ini-production /usr/local/php/etc/php.ini
安装php7
- 下载
wget http://cn2.php.net/distributions/php-7.1.6.tar.bz2
- 解压
tar jxvf php-7.1.6.tar.bz2
- 编译
./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
- 复制配置文件到
cp php.ini-production /usr/local/php7/etc/php.ini
拓展
php中mysql,mysqli,mysqlnd,pdo到底是什么 http://blog.csdn.net/u013785951/article/details/60876816
查看编译参数 http://ask.apelearn.com/question/1295