溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

linux中安裝php5的方法

發(fā)布時間:2021-05-14 09:59:21 來源:億速云 閱讀:295 作者:小新 欄目:編程語言

這篇文章將為大家詳細講解有關(guān)linux中安裝php5的方法,小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。

linux安裝php5的方法:首先下載“php-5.6.2.tar.gz”包;然后進行解壓;接著通過“make install”進行編譯安裝;最后修改配置php.ini等相關(guān)文件即可。

本文操作環(huán)境:linux5.9.8系統(tǒng)、PHP5.6版、Dell G3電腦。

linux安裝php5和php7兩個版本

多版本的安裝:
1.區(qū)分php安裝的目錄
2.fpm的配置:端口號的區(qū)分
3.nginx配置文件要區(qū)分:fastcgi_pass 127.0.0.1:9000;

安裝php5

 1. 下載包
 wget http://mirrors.sohu.com/php/php-5.6.2.tar.gz
 
 2. 解壓
 tar -zxvf php-5.6.2.tar.gz
 cd php-5.6.2.tar.gz
 
 3. 編譯安裝
 依賴的話提示缺啥就安裝
 
'./configure'  '--prefix=/usr/local/php5.4.9' '--enable-fpm'  '--enable-inline-optimization' '--disable-debug' '--disable-rpath' '--enable-shared' '--enable-soap' '--with-xmlrpc' '--with-openssl' '--with-mcrypt' '--with-pcre-regex' '--with-sqlite3' '--with-zlib' '--enable-bcmath' '--with-iconv' '--with-bz2' '--enable-calendar' '--with-curl' '--with-cdb' '--enable-dom' '--enable-exif' '--enable-fileinfo' '--enable-filter' '--with-pcre-dir' '--enable-ftp' '--with-gd' '--with-openssl-dir' '--with-jpeg-dir' '--with-png-dir' '--with-freetype-dir' '--enable-gd-native-ttf' '--enable-gd-jis-conv' '--with-gettext' '--with-gmp' '--with-mhash' '--enable-json' '--enable-mbstring' '--enable-mbregex' '--enable-mbregex-backtrack' '--with-libmbfl' '--with-onig' '--with-mysql=mysqlnd' '--enable-pdo' '--with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd' '--with-zlib-dir' '--with-pdo-sqlite' '--with-readline' '--enable-session' '--enable-shmop' '--enable-simplexml' '--enable-sockets' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--enable-wddx' '--with-libxml-dir' '--with-xsl' '--enable-zip' '--enable-mysqlnd-compression-support' '--with-pear'

make && make install

4. fpm配置文件
 cp /usr/local/php5.6.2/etc/php-fpm.conf.default     /usr/local/php5.6.2/etc/php-fpm.conf
vim /usr/local/php5.6.2/etc/php-fpm.conf

linux中安裝php5的方法
linux中安裝php5的方法
linux中安裝php5的方法

修改用戶和組、修改端口

5. 配置php.ini文件
cp php.ini-development /usr/local/php5.6.2/lib/php.ini

6. 配置fpm自啟服務
cp sapi/fpm/php-fpm.service /usr/lib/systemd/system/php5-fpm.service
vim /usr/lib/systemd/system/php5-fpm.service
修改路徑前綴

linux中安裝php5的方法

systemctl daemon-reload
systemctl enable php5-fpm
systemctl start php5-fpm
systemctl status php5-fpm

7. 配置nginx
修改成php5-fpm 開啟的端口號
fastcgi_pass 127.0.0.1:9005;
nginx -s reload

什么是Linux系統(tǒng)

Linux是一種免費使用和自由傳播的類UNIX操作系統(tǒng),是一個基于POSIX的多用戶、多任務、支持多線程和多CPU的操作系統(tǒng),使用Linux能運行主要的Unix工具軟件、應用程序和網(wǎng)絡(luò)協(xié)議。

關(guān)于“l(fā)inux中安裝php5的方法”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,使各位可以學到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI