服務(wù)器
這篇文章主要為大家展示了“Ubuntu如何安裝PHP和PHP Nginx配置”,內(nèi)容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領(lǐng)大家一起研究并學(xué)習(xí)一下“Ubuntu如何安裝PHP和PHP Nginx配置”這篇文章吧。
一、刪除遺留的PHP包
sudoapt-getpurge`dpkg-l|grepphp|awk'{print$2}'|tr"\\n"""`sudoaptautoremove二、添加PPA
sudoapt-getinstall-ylanguage-pack-en-basesudoLC_ALL=en_US.UTF-8add-apt-repositoryppa:ondrej/phpsudoapt-getupdate三、安裝PHP
PHP 5.6 版本
sudoapt-getinstallphp5.6php5.6-clisudoapt-getinstallphp5.6-devphp5.6-fpmphp5.6-cgisudoapt-getinstallphp5.6-mbstringphp5.6-mcryptphp5.6-mysqlphp5.6-gdphp5.6-curlphp5.6-memcachePHP 7.1 版本
sudoapt-getinstallphp7.1php7.1-clisudoapt-getinstallphp7.1-devphp7.1-fpmphp7.1-cgisudoapt-getinstallphp7.1-mysqlphp7.1-gdphp7.1-curlphp7.1-memcache四、Nginx配置
#Passall.phpfilesontoaphp-fpm/php-fcgiserver.location~[^/]\\.php(/|$){fastcgi_split_path_info^(.+?\\.php)(/.*)$;if(!-f$document_root$fastcgi_script_name){return404;}fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;#fastcgi_passunix:/run/php/php5.6-fpm.sock;fastcgi_passunix:/run/php/php7.1-fpm.sock;fastcgi_indexindex.php;includefastcgi_params;}以上是“Ubuntu如何安裝PHP和PHP Nginx配置”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學(xué)習(xí)更多知識,歡迎關(guān)注資訊頻道!