Linux环境下Nginx配置安装PHP

下边的安装配置方法,我试了一晚上没有成功,可能因为我的系统环境比较复杂,所以建议:

先安装PHP。使用yum命令安装,在安装配置MySQL,具体做法看博客中其他文章,至于Nginx服务器可以安装完这两个之后再安装配置,因为我目前不使用Nginx,直接使用Apache服务器,所以就没有在系统上编译安装Nginx,目前使用Wordpress,不需要Nginx,只要PHP和Mysql安装配置好,就可以了;

1.下载PHP依赖库:

wget http://soft.beauty-soft.net/lib/libiconv/libiconv-1.13.1.tar.gz

wget http://soft.beauty-soft.net/lib/mcrypt/libmcrypt-2.5.8.tar.gz

wget http://soft.beauty-soft.net/lib/mcrypt/mcrypt-2.6.8.tar.gz

wget http://soft.beauty-soft.net/lib/mhash/mhash-0.9.9.9.tar.gz

wget http://soft.beauty-soft.net/lib/libiconv/php-5.3.6.tar.gz

2.下载后安装:

tar zxvf libiconv-1.13.1.tar.gz

cd libiconv-1.13.1/

./configure --prefix=/usr/local

make

make install

cd ../

tar zxvf libmcrypt-2.5.8.tar.gz

cd libmcrypt-2.5.8/

./configure

make

make install

/sbin/ldconfig

cd libltdl/

./configure --enable-ltdl-install

make

make install

cd ../../

tar zxvf mhash-0.9.9.9.tar.gz

cd mhash-0.9.9.9/

./configure

make

make install

cd ../

ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la

ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so

ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4

ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8

ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a

ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la

ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so

ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2

ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1

ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config

tar zxvf mcrypt-2.6.8.tar.gz

cd mcrypt-2.6.8/

/sbin/ldconfig

./configure

make

make install

cd ../

3.安装PHP:必须加入php-fpm扩展,还有MySQL数据库的相应扩展;

tar zxvf php-5.3.6.tar.gz

cd php-5.3.6

./configure  --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc  --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-magic-quotes --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --with-mime-magic --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd

4.执行错误:configure: error: xml2-config not found. Please check your libxml2 installation.

解决办法:

5.执行错误:configure: error: libjpeg.(a|so) not found.

解决办法:

6.执行错误:configure: error: libpng.(a|so) not found.

解决办法:ln -s /usr/lib64/libpng.so /usr/lib/libpng.so

make ZEND_EXTRA_LIBS='-liconv'

7.执行错误:make: *** [ext/dom/node.lo] Error 1

解决办法:在这之前要安装patch命令到linux中:yum -y install patch

 

8.执行错误:make: *** [sapi/cgi/php-cgi] Error 1

解决办法:

make install

原文地址:https://www.cnblogs.com/hqutcy/p/6122080.html