安装 php

1.下载
http://www.php.net/downloads.php

2.安装 依赖包
 
 
yum -y install epel-release
yum install -y libxml2-devel openssl openssl-devel bzip2 bzip2-devel libpng libpng-devel freetype freetype-devel libjpeg-devel libmcrypt-devel

3.编译安装
php5
./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-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 \
--disable-ipv6

php7:
./configure \
--prefix=/usr/local/php \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-config-file-path=/usr/local/php/etc  \
--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 \
--disable-ipv6 \
--with-pdo-mysql=/usr/local/mysql
make && make install
因为php_mysql由于安全问题被弃用了,代之的是php_mysqli。php5.6的时候就已经不能使用了
4.常用操作
1)列出模块
/usr/local/php/bin/php -m
2)列出模块具体信息
/usr/local/php/bin/php -i



你可能感兴趣的:(安装 php)