cd /downloads
wget http://219.239.26.11/files/300100000CF0F2B1/cn2.php.net/distributions/php-7.3.0.tar.gz
wget https://nginx.org/download/nginx-1.14.2.tar.gz
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.42.tar.gz
wget http://www.zlib.net/fossils/zlib-1.2.11.tar.gz
tar zxvf xxx.tar.gz
安装pcre
cd /downloads/pcre-8.42
yum -y install gcc-c++
./configure
make
make install
安装zlib
cd /downloads/zlib-1.2.11
./configure
make
make install
cd /downloads/nginx-1.14.2
./configure --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_ssl_module --with-http_v2_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre=../pcre-8.42 --with-zlib=../zlib-1.2.11
cd /downloads/php-7.3.0
./configure --prefix=/usr/local/php73 --with-config-file-path=/etc/php73 --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-opcache --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-mbstring --with-iconv --with-mcrypt --with-mhash --with-openssl --enable-bcmath --enable-soap --with-libxml-dir --enable-pcntl --enable-shmop --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-sockets --with-curl --with-zlib --enable-zip --with-readline --without-sqlite3 --without-pdo-sqlite --with-pear
make
make install
[root@izhp3bslxpl2fujj3ccp5iz php-7.3.0]# make install
Installing shared extensions: /usr/local/php73/lib/php/extensions/no-debug-non-zts-20180731/
Installing PHP CLI binary: /usr/local/php73/bin/
Installing PHP CLI man page: /usr/local/php73/php/man/man1/
Installing PHP FPM binary: /usr/local/php73/sbin/
Installing PHP FPM defconfig: /usr/local/php73/etc/
Installing PHP FPM man page: /usr/local/php73/php/man/man8/
Installing PHP FPM status page: /usr/local/php73/php/php/fpm/
Installing phpdbg binary: /usr/local/php73/bin/
Installing phpdbg man page: /usr/local/php73/php/man/man1/
Installing PHP CGI binary: /usr/local/php73/bin/
Installing PHP CGI man page: /usr/local/php73/php/man/man1/
Installing build environment: /usr/local/php73/lib/php/build/
Installing header files: /usr/local/php73/include/php/
Installing helper programs: /usr/local/php73/bin/
program: phpize
program: php-config
Installing man pages: /usr/local/php73/php/man/man1/
page: phpize.1
page: php-config.1
Installing PEAR environment: /usr/local/php73/lib/php/
Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in phar:///downloads/php-7.3.0/pear/install-pear-nozlib.phar/PEAR/PackageFile/v2/Validator.php on line 1933
[PEAR] Archive_Tar - installed: 1.4.3
[PEAR] Console_Getopt - installed: 1.4.1
[PEAR] Structures_Graph- installed: 1.1.1
[PEAR] XML_Util - installed: 1.4.2
[PEAR] PEAR - installed: 1.10.5
Wrote PEAR system config file at: /usr/local/php73/etc/pear.conf
You may want to add: /usr/local/php73/lib/php to your php.ini include_path
/downloads/php-7.3.0/build/shtool install -c ext/phar/phar.phar /usr/local/php73/bin
ln -s -f phar.phar /usr/local/php73/bin/phar
Installing PDO headers: /usr/local/php73/include/php/ext/pdo/
checking for cURL 7.15.5 or greater... configure: error: cURL version 7.15.5 or later is required to compile php with cURL support
解决: yum -y install curl-devel
configure: error: libxml2 not found. Please check your libxml2 installation.
解决: yum -y install libxml2-devel
configure: error: Please reinstall readline - I cannot find readline.h
解决: yum -y install readline-devel
configure: error: Please reinstall the libzip distribution
解决: yum -y install libzip-devel
若提示libzip版本低,则手动编译安装最新版:
yum remove libzip-devel
cd /downloads
yum install cmake3
wget https://libzip.org/download/libzip-1.5.1.tar.gz
tar zxvf libzip-1.5.1.tar.gz
cd libzip-1.5.1
mkdir build
cd build
cmake3 ..
make
make install
configure: error: off_t undefined; check your library configuration
解决:
echo '/usr/local/lib64
/usr/local/lib
/usr/lib
/usr/lib64'>>/etc/ld.so.conf&&ldconfig -v
cp /usr/local/php73/etc/php-fpm.conf.default /usr/local/php73/etc/php-fpm.conf
cp /usr/local/php73/etc/php-fpm.d/www.conf.default /usr/local/php73/etc/php-fpm.d/www.conf
vim /usr/local/php73/etc/php-fpm.d/www.conf 将user和group设置成nginx
ln -s /usr/local/php73/sbin/php-fpm /usr/bin/php-fpm
ln -s /usr/local/php73/bin/php /usr/bin/php
groupadd nginx
mkdir /html
chown -R root:nginx /html/
useradd -g nginx nginx
把nginx.conf的user也设置成nginx
vim /usr/local/nginx/nginx.conf
在最后一个中括号的上面,引入vhosts目录下所有conf文件,引入多个server配置
include /usr/local/nginx/vhosts/*.conf;
然后在vhosts下创建一个conf文件,增加一个域名server配置
server {
listen 80;
server_name yourdomain.com;
root /html/test/yourdomain/public;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
root /html/test/yourdomain/public;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /html/test/yourdomain/public/$fastcgi_script_name;
include fastcgi_params;
}
}
php-fpm
nginx
创建server中配置的目录和文件。
最后把域名指向服务器,访问一下试试。