如何安裝Php7.3-創(chuàng)新互聯(lián)

這篇文章給大家分享的是有關(guān)如何安裝Php7.3的內(nèi)容。小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,一起跟隨小編過(guò)來(lái)看看吧。

我們提供的服務(wù)有:網(wǎng)站設(shè)計(jì)制作、成都網(wǎng)站建設(shè)、微信公眾號(hào)開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、剛察ssl等。為成百上千企事業(yè)單位解決了網(wǎng)站和推廣的問(wèn)題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的剛察網(wǎng)站制作公司

首先安裝(安裝過(guò)了就不用安裝了):

mysql:https://blog.csdn.net/qq_40200087/article/details/89479137

nginx:https://blog.csdn.net/qq_40200087/article/details/89504980

下載:https://www.php.net/downloads.php#v7.3.4

開發(fā)工具:

 yum groupinstall "Development Tools" -y

安裝依賴:

yum install libxml2-devel -y

yum install bzip2 bzip2-devel -y 

yum install curl-devel -y

yum install libjpeg-devel -y

yum install libpng libpng-devel -y

yum install freetype-devel -y

yum install libxslt-devel -y 

yum install libzip-devel  -y


或者合到一起安裝
yum install libxml2-devel bzip2 bzip2-devel curl-devel libjpeg-devel libpng libpng-devel freetype-devel libxslt-devel libzip-devel -y

解壓:

tar -zxvf php-xxx.tar.gz -C /usr/local/

進(jìn)入到/usr/local 并修改名字

cd /usr/local

mv php-7.3.xxx  php7.3

編譯

cd /usr/local/php7.3 

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-fpm-user=mysql --with-fpm-group=mysql --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli=mysqlnd --with-openssl --with-pcre-regex --with-pdo-mysql=mysqlnd --with-mysql=mysqlnd --with-pdo-sqlite --with-pear --with-png-dir --with-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-bz2 --with-mhash --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml --enable-fpm
編譯完成后是以下樣子

+--------------------------------------------------------------------+
| License:                                                           |
| This software is subject to the PHP License, available in this     |
| distribution in the file LICENSE.  By continuing this installation |
| process, you are bound by the terms of this license agreement.     |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                            |
+--------------------------------------------------------------------+

Thank you for using PHP.

config.status: creating php7.spec
config.status: creating main/build-defs.h
config.status: creating scripts/phpize
config.status: creating scripts/man1/phpize.1
config.status: creating scripts/php-config
config.status: creating scripts/man1/php-config.1
config.status: creating sapi/cli/php.1
config.status: creating sapi/fpm/php-fpm.conf
config.status: creating sapi/fpm/www.conf
config.status: creating sapi/fpm/init.d.php-fpm
config.status: creating sapi/fpm/php-fpm.service
config.status: creating sapi/fpm/php-fpm.8
config.status: creating sapi/fpm/status.html
config.status: creating sapi/phpdbg/phpdbg.1
config.status: creating sapi/cgi/php-cgi.1
config.status: creating ext/phar/phar.1
config.status: creating ext/phar/phar.phar.1
config.status: creating main/php_config.h
config.status: executing default commands
configure: WARNING: unrecognized options: --with-mysql

安裝:

make && make install

復(fù)制以下三個(gè)配置文件

cp php.ini-production /usr/local/php/etc/php.ini

cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

cp /usr/local/php/etc/php-fpm.d/www.conf.default  /usr/local/php/etc/php-fpm.d/www.conf

設(shè)置php.ini

#注意:php的注釋為 ; 如果設(shè)置前面有 ; ,請(qǐng)記得刪除 ;
vim /usr/local/php/etc/php.ini

max_execution_time = 300
max_input_time = 300
memory_limit = 128M
post_max_size = 16M
upload_max_filesize = 2M
date.timezone = Asia/Shanghai

測(cè)試php是否安裝成功

/usr/local/php/sbin/php-fpm -t

拷貝啟動(dòng)文件

cp /usr/local/php7.3/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

賦予執(zhí)行權(quán)限

chmod 755 /etc/init.d/php-fpm

啟動(dòng)

service php-fpm start

查詢是否啟動(dòng)成功

ps -ef |grep php-fpm

root      27332      1  0 08:51 ?        00:00:00 php-fpm: master process (/usr/local/php/etc/php-fpm.conf)
mysql     27333  27332  0 08:51 ?        00:00:00 php-fpm: pool www
mysql     27334  27332  0 08:51 ?        00:00:00 php-fpm: pool www
root      27336   7898  0 08:51 pts/1    00:00:00 grep --color=auto php-fpm

配置 nginx可解析 .php文件

注意:fastcgi_pass 127.0.0.1:9000; 端口與/usr/local/php/etc/php-fpm.d/www.conf 里面的listen = 127.0.0.1:9000 配置要一樣,不然無(wú)法解析


vim /usr/local/nginx/conf/nginx.conf 修改server{} 這個(gè)里面的數(shù)據(jù)為:

        listen       80;
        server_name  localhost;

        access_log  /usr/local/nginx/logs/host.access.log;
        root /usr/local/nginx/html;
        index  index.html index.htm index.php;
        location / {
            try_files $uri $uri/ /index.php?$args;
        }


        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        location ~ \.php$ {
            expires -1s;
            try_files $uri =404;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi.conf;
        }

測(cè)試是否解析成功:

在/usr/local/nginx/html中創(chuàng)建test.php,里面內(nèi)容如下

<?php
 phpinfo();
?>

執(zhí)行 /usr/local/nginx/sbin/nginx

瀏覽去輸入 http://本機(jī)ip/test.php

如果打開網(wǎng)頁(yè)了則解析成功,如果是下載,則解析失敗

遇到一個(gè)錯(cuò)誤:

執(zhí)行測(cè)試的時(shí)候遇到

[root@jenkins-master etc]# /usr/local/php/sbin/php-fpm -t
PHP:  syntax error, unexpected '=' in Unknown on line 1
[25-Apr-2019 08:36:28] ERROR: Unable to include /usr/local/php/etc/php-fpm.d/www.conf from /usr/local/php/etc/php-fpm.conf at line 23
[25-Apr-2019 08:36:28] ERROR: failed to load configuration file '/usr/local/php/etc/php-fpm.conf'
[25-Apr-2019 08:36:28] ERROR: FPM initialization failed



最后發(fā)現(xiàn)是我執(zhí)行./configue 的時(shí)候后面配置文件有一個(gè)少了個(gè)空格,我已修改上面的配置

原因呢是因?yàn)?nbsp;www.conf 里面的user配置錯(cuò)誤

感謝各位的閱讀!關(guān)于“如何安裝Php7.3”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,讓大家可以學(xué)到更多知識(shí),如果覺(jué)得文章不錯(cuò),可以把它分享出去讓更多的人看到吧!

新聞名稱:如何安裝Php7.3-創(chuàng)新互聯(lián)
本文來(lái)源:http://bm7419.com/article26/didejg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供Google、企業(yè)網(wǎng)站制作手機(jī)網(wǎng)站建設(shè)、域名注冊(cè)、App開發(fā)響應(yīng)式網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)