nginx php 安装

时间:2022-03-01 20:03:34

.选定源码目录
选定目录 /data/klj/

cd /data/klj/

2.安装PCRE库
cd /data/klj/
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.34.tar.gz
tar -zxvf pcre-8.21.tar.gz
cd pcre-8.21
./configure
make
make install

3.安装zlib库
cd /data/klj/
wget http://zlib.net/zlib-1.2.8.tar.gz
tar -zxvf zlib-1.2.8.tar.gz cd zlib-1.2.8
./configure
make
make install

4.安装ssl

cd /data/klj/
wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz
tar -zxvf openssl-1.0.1c.tar.gz
./config
make
make install

5.安装nginx

Nginx 一般有两个版本,分别是稳定版和开发版,您可以根据您的目的来选择这两个版本的其中一个,下面是把 Nginx 安装到 /usr/local/nginx 目录下的详细步骤:

cd /data/klj/
wget http://nginx.org/download/nginx-1.7.8.tar.gz
tar -zxvf nginx-1.2.8.tar.gz
cd nginx-1.2.8
./configure --with-pcre=/data/klj/pcre-8.21 --with-zlib=/data/klj/zlib-1.2.8 --with-openssl=/data/klj/openssl-1.0.1c --prefix=/usr/local/nginx
make
make install

安装php
下载php安装包
wget http://cn2.php.net/get/php-5.6.3.tar.gz/from/this/mirror

tar -zxvf php-5.6.3.tar.gz
cd php-5.6.3

./configure --prefix=/data/klj/php --with-config-file-path=/data/klj/php/etc --with-mysql --with-mysqli --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --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-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap --enable-pdo --with-pdo-mysql=mysqlnd

./configure --prefix=/data/klj/php --with-config-file-path=/data/klj/php/etc --with-mysql --with-mysqli --enable-mbstring --enable-sockets --enable-pcntl --enable-zip --enable-bcmath --with-zlib-dir --with-bz2 --with-freetype-dir --with-gd --with-libxml-dir --with-png-dir --with-jpeg-dir=/usr/local/jpeg --enable-mbstring --with-mcrypt --with-curl --enable-fasecgi --enable-fpm

./configure --prefix=/data/klj/php-5.6.14 --with-config-file-path=/data/klj/php-5.6.14/etc --with-mysql --with-mysqli --with-iconv-dir=/usr/local --with-freetype-dir=/usr/local/freetype --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --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 --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap --enable-pdo --with-pdo-mysql=mysqlnd --with-png-dir=/usr/local/png --with-jpeg-dir=/usr/local/jpeg --enable-mbstring --with-mcrypt --with-curl --enable-fasecgi --enable-fpm

error 5

checking whether to enable JIS-mapped Japanese font support in GD... no
checking for fabsf... yes
checking for floorf... yes
configure: error: jpeglib.h not found
GD库没有安装
解决办法
yum install libjpeg.x86_64 libpng.x86_64 freetype.x86_64 libjpeg-devel.x86_64 libpng-devel.x86_64 freetype-devel.x86_64 -y

1)去网站 http://www.ijg.org/ 下载源码。我用的版本是jpegsrc.v8d.tar.gz,执行命令:sudo tar -zxvf jpegsrc.v8d.tar.gz -C /usr/src

(2)进入/usr/src/jpegsrc.v8d目录,sudo方式执行命令:sudo ./configure --prefix=/usr/local/jpeg;make;make install;

(3)重新编译php,增加参数--with-jpeg-dir=/usr/local/jpeg

再次编译,遇到问题:configure: error: mcrypt.h not found. Please reinstall libmcrypt.

(1)去网站http://mcrypt.hellug.gr/lib/index.html 的下载源码,我下的版本是libmcrypt-2.5.7.tar.gz;执行命令:sudo tar -zxvf libmcrypt-2.5.7.tar.gz -C /usr/src

(2)进入/usr/src/libmcrypt-2.5.7目录,sudo方式执行命令:./configure prefix=/usr/local/libmcrypt/;make ;make install

(3)重新编译php,这时增加参数--with-mcrypt=/usr/local/libmcrypt

先安装Libmcrypt

#tar -zxvf libmcrypt-2.5.8.tar.gz
#cd libmcrypt-2.5.8
#./configure
#make
#make install 说明:libmcript默认安装在/usr/local

3.安装mhash

#tar -zxvf mhash-0.9.9.9.tar.gz
#cd mhash-0.9.9.9
#./configure
#make
#make install
4.安装mcrypt

#tar -zxvf mcrypt-2.6.8.tar.gz
#cd mcrypt-2.6.8
#LD_LIBRARY_PATH=/usr/local/lib ./configure
#make
#make install

此安装主要针对Linux系统
首先要下载三个软件,分别是
libmcrypt-2.5.8.tar.gz
下载地址:

wget http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz/download

mhash-0.9.9.tar.gz
下载地址: wget http://sourceforge.net/projects/mhash/files/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz/download
mcrypt-2.6.8.tar.gz
下载地址:

wget http://sourceforge.net/projects/mcrypt/files/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz/download