溫馨提示×

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

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

php5.6.27的安裝教程

發(fā)布時(shí)間:2021-06-24 10:03:52 來源:億速云 閱讀:174 作者:chen 欄目:編程語言

本篇內(nèi)容主要講解“php5.6.27的安裝教程”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實(shí)用性強(qiáng)。下面就讓小編來帶大家學(xué)習(xí)“php5.6.27的安裝教程”吧!

php5.6.27安裝方法:首先安裝編譯工具,并添加php組和用戶;然后安裝依賴,添加擴(kuò)展包,更新yum源;接著下載php并解壓安裝;最后配置PHP即可。

本文操作環(huán)境:windows7系統(tǒng)、PHP7.1版,DELL G3電腦

php5.6.27安裝教程

centos7 編譯安裝php5.6.27

安裝編譯工具

yum -y install gcc gcc-c++

添加php組和用戶,不創(chuàng)建home目錄,不允許登陸系統(tǒng)

#-M, --no-create-home        不創(chuàng)建用戶的主目錄
#-g, --gid GROUP        新賬戶主組的名稱或 ID
#-s, --shell SHELL        新賬戶的登錄 shell
groupadd web
useradd -M -s /sbin/nologin -g web php

安裝依賴,沒有l(wèi)ibmcrypt libmcrypt-devel mcrypt mhash的話,添加擴(kuò)展包,更新yum源

yum -y install epel-release
yum -y update
yum -y install libmcrypt libmcrypt-devel mcrypt mhash
yum -y install libxml2-devel libpng-devel libjpeg-devel zlib bzip2 bzip2-devel \
libtool-ltdl-devel pcre-devel openssl-devel freetype-devel libcurl-devel icu \
perl-libintl postgresql libicu-devel

下載php解壓

cd /usr/local/src/
wget http://cn2.php.net/distributions/php-5.6.27.tar.gz
tar -zxvf php-5.6.27.tar.gz
cd php-5.6.27/

安裝php

./configure \
--prefix=/usr/local/php5.6.27 \
--with-config-file-path=/usr/local/php5.6.27/etc/ \
--enable-inline-optimization \
--enable-shared \
--enable-opcache \
--enable-fpm \
--with-fpm-user=php \
--with-fpm-group=web \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-gettext \
--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 \
--enable-intl \
--with-curl \
--with-zlib \
--enable-zip \
--with-bz2 \
--enable-xml \
--with-pcre-dir \
--with-gd \
--enable-static \
--enable-wddx \
--with-xmlrpc \
--with-libdir=/usr/lib64 \
--with-jpeg-dir=/usr/lib64 \
--with-freetype-dir=/usr/lib64 \
--with-png-dir=/usr/lib64
make && make install

配置 PHP

cp php.ini-development /usr/local/php5.6.27/etc/php.ini
cp /usr/local/php5.6.27/etc/php-fpm.conf.default /usr/local/php5.6.27/etc/php-fpm.conf

創(chuàng)建開機(jī)啟動(dòng)

vi /lib/systemd/system/php-fpmd.service
[Unit]
Description=The PHP FastCGI Process Manager
After=network.target
[Service]
Type=forking
PIDFile=/run/php-fpm.pid
ExecStart=/usr/local/php5.6.27/sbin/php-fpm --daemonize -g /run/php-fpm.pid
ExecReload=/bin/kill -USR2 $MAINPID
ExecStop=/bin/kill -SIGINT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target

PS:如果yum安裝,php-fpm.service文件的內(nèi)容

[Unit]
Description=The PHP FastCGI Process Manager
After=syslog.target network.target
[Service]
Type=notify
PIDFile=/run/php-fpm.pid
EnvironmentFile=/etc/sysconfig/php-fpm
ExecStart=/usr/sbin/php-fpm --nodaemonize
ExecReload=/bin/kill -USR2 $MAINPID
PrivateTmp=true
[Install]

WantedBy=multi-user.target

添加運(yùn)行權(quán)限

chmod +x /lib/systemd/system/php-fpmd.service

設(shè)置開機(jī)自啟動(dòng)

systemctl enable php-fpmd.service

運(yùn)行

systemctl start php-fpmd.service

停止

systemctl stop php-fpmd.service

重新加載

systemctl daemon-reload

刪除開機(jī)啟動(dòng)

systemctl disable php-fpmd.service

到此,相信大家對(duì)“php5.6.27的安裝教程”有了更深的了解,不妨來實(shí)際操作一番吧!這里是億速云網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!

向AI問一下細(xì)節(jié)

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

php
AI