linux安裝php7的方法詳解
linux如何安裝php7?
1、安裝依賴(lài)包
yum install -y gcc gcc-c++ make zlib zlib-devel pcre pcre-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
2、下載安裝包
cd /usr/local2 wget https://www.php.net/distributions/php-7.1.31.tar.gz
3、解壓
tar -zxvf php-7.1.31.tar.gz
4、檢查當(dāng)前的環(huán)境是否滿(mǎn)足要安裝軟件的依賴(lài)關(guān)系
cd php-7.1.31
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php --enable-mbstring --enable-ftp --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --without-pear --disable-phar --enable-sockets --with-freetype-dir=/usr --with-zlib --with-libxml-dir=/usr --with-xmlrpc --enable-zip --enable-fpm --enable-xml --enable-sockets --with-gd --with-zlib --with-iconv --enable-zip --with-freetype-dir=/usr/lib/ --enable-soap --enable-pcntl --enable-cli --with-curl
5、編譯安裝
make make install
6、在之前編譯的源碼包中,找到 php.ini-production,復(fù)制到/usr/local/php下,并改名為php.ini:
cp php.ini-production /usr/local/php/php.ini
[可選項(xiàng)] 設(shè)置讓PHP錯(cuò)誤信息打印在頁(yè)面上
vi /usr/local/php/php.ini
將Off改成On
8.復(fù)制啟動(dòng)腳本
$ cp ./sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm $ chmod +x /etc/init.d/php-fpm
修改php-fpm配置文件:
$ cd /usr/local/php/etc $ cp php-fpm.conf.default php-fpm.conf $ vi php-fpm.conf
去掉 pid = run/php-fpm.pid 前面的分號(hào)
$ cd php-fpm.d $ cp www.conf.default www.conf $ vi www.conf
修改user和group的用戶(hù)為當(dāng)前用戶(hù)(也可以不改,默認(rèn)會(huì)添加nobody這個(gè)用戶(hù)和用戶(hù)組)
9.啟動(dòng)PHP
$ /etc/init.d/php-fpm start #php-fpm啟動(dòng)命令 $ /etc/init.d/php-fpm stop #php-fpm停止命令 $ /etc/init.d/php-fpm restart #php-fpm重啟命令 $ ps -ef | grep php 或者 ps -A | grep -i php #查看是否已經(jīng)成功啟動(dòng)PHP
10.開(kāi)機(jī)自啟動(dòng)
vi /etc/rc.local
將 /etc/init.d/php-fpm start 添加進(jìn)去chmod +x /etc/rc.d/rc.local
以上就是linux如何安裝php7的全部?jī)?nèi)容,感謝大家的學(xué)習(xí)和對(duì)腳本之家的支持。
相關(guān)文章
Centos7 Mysql 5.6 多主一從 解決方案與詳細(xì)配置
這篇文章主要介紹了Centos7 Mysql 5.6 多主一從 解決方案與詳細(xì)配置,需要的朋友可以參考下2016-04-04ubuntu系統(tǒng)下禁用utc時(shí)間的設(shè)置方法
這篇文章主要給大家介紹了在ubuntu系統(tǒng)下禁用utc時(shí)間的設(shè)置方法,需要的朋友可以參考下2017-05-05Linux中ifconfig命令查不到IP的問(wèn)題及解決
這篇文章主要介紹了Linux中ifconfig命令查不到IP的問(wèn)題及解決,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2024-07-07你必須知道Linux系統(tǒng)的七種優(yōu)勢(shì)
你必須知道Linux系統(tǒng)的七種優(yōu)勢(shì),越來(lái)越多的電腦用戶(hù)開(kāi)始使用 Linux進(jìn)行辦公、學(xué)習(xí),這篇文章主要介紹了Linux系統(tǒng)的多種優(yōu)勢(shì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-03-03SSH遠(yuǎn)程登錄和端口轉(zhuǎn)發(fā)詳解
這篇文章主要介紹了關(guān)于SSH遠(yuǎn)程登錄和端口轉(zhuǎn)發(fā)的相關(guān)資料,文中介紹的非常詳細(xì),需要的朋友可以參考借鑒,下面來(lái)一起看看吧。2017-03-03