php安装详解
获取资源:
cd /usr/local/src/
wget http://cn2.php.net/distributions/php-5.4.45.tar.bz2
tar jxvf php-5.4.45.tar.bz2
环境配置:
rpm -ivh \’http://www.lishiming.net/data/attachment/forum/epel-release-6-8_64.noarch.rpm\’
yum install -y libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libjpeg libjpeg-devel libpng libpng-devel freetype-devel libmcrypt-devel
apache编译、安装:
cd php-5.4.45
./buildconf –force
./configure –prefix=/usr/local/php \
–with-apxs2=/usr/local/apache/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
make
make install
echo $?
0
安装成功!
LNMP中php编译、安装:
./configure \
–prefix=/usr/local/php \
–with-config-file-path=/usr/local/php/etc/ \
–enable-fpm \
–with-fpm-user=php-fpm \
–with-fpm-group=php-fpm \
–with-mysql=/usr/local/mysql \
–with-mysql-sock=/tmp/mysql.sock \
–with-libxml-dir \
–with-gd \
–with-jpeg-dir \
–with-png-dir \
–with-freetype-dir \
–with-iconv-dir \
–with-zlib-dir \
–with-mcrypt \
–enable-soap \
–enable-gd-native-ttf \
–enable-ftp \
–enable-mbstring \
–enable-exif \
–disable-ipv6
make
make install
LNMP php配置:
cp php.ini-production /usr/local/php/etc/php.ini
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmodd 755 /etc/init.d/php-fpm
useradd -s /sbin/nologin php-fpm
cd /usr/local/php/etc/
mv php-fpm.conf.default php-fpm.conf
/usr/local/php/sbin/php-fpm -t
chkconfig –add php-fpm
chkconfig php-fpm on
service php-fpm start
注:在编译过程中可能会出现很多错,大多数是因为缺少包的原因,却啥包装啥,上面环境配置中,基本上包含了本次安装所有需要的包