centos7搭建lnmp編譯安裝php【一】
1.官網下載安裝包php-5.6.11.tar.gz
2.通過命令解壓檔案
[root@localhost share]# tar -zxvf php-5.6.11.tar.gz
3.安裝一些庫,執行下面命令
yum install -y gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libpng libpng-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses curl openssl-devel gdbm-devel
db4-devel libXpm-devel libX11-devel gd-devel gmp-devel readline-devel libxslt-devel expat-devel xmlrpc-c xmlrpc-c-devel
4.進入解壓目錄執行
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-mysql-sock --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-fpm --with-ncurses --enable-soap --with-libxml-dir --with-XMLrpc --with-openssl --with-mcrypt --with-mhash --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-zlib-dir --with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext --with-gmp --with-mhash --enable-json --enable-mbstring --disable-mbregex --disable-mbregex-backtrack --with-libmbfl --with-onig --enable-pdo --with-pdo-mysql --with-zlib-dir
--with-pdo-sqlite --with-readline --enable-session --enable-shmop --enable-simplexml --enable-sockets --enable-sqlite-utf8 --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-libxml-dir --with-xsl --enable-zip --enable-mysqlnd-compression-support
--with-pear
注: --with-config-file-path=/usr/local/php/etc 指定自己的php.ini路徑
5.配置執行完畢,下面執行編譯和安裝
[root@localhost php-5.6.11]# make &&make install
6.進入安裝php的目錄/usr/local/php,進入etc,
[root@localhost etc]# pwd/usr/local/php/etc
然後複製一份php-fpm.conf配置,執行
[root@localhost etc]# cp php-fpm.conf.default php-fpm.conf
7.設定環境變數php-fpm,執行
[root@localhost etc]# vim /etc/profile
在檔案最後加入:
export PATH="/usr/local/php/sbin:$PATH"
立即使環境變數生效:
[root@localhost etc]# source /etc/profile
8.進入目錄/etc/init.d/中建立檔案php-fpm,加入如下內容:
#!/bin/bash
#
# Startup script for the PHP-FPM server.
#
# chkconfig: 345 85 15
# description: PHP is an HTML-embedded scripting language
# processname: php-fpm
# config: /usr/local/php/etc/php.ini
# Source function library.
. /etc/rc.d/init.d/functions
PHP_PATH=/usr/local
DESC="php-fpm daemon"
NAME=php-fpm
# php-fpm路徑
DAEMON=$PHP_PATH/php/sbin/$NAME
# 配置檔案路徑
CONFIGFILE=$PHP_PATH/php/etc/php-fpm.conf
# PID檔案路徑(在php-fpm.conf設定)
PIDFILE=$PHP_PATH/php/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
rh_start() {
$DAEMON -y $CONFIGFILE || echo -n " already running"
}
rh_stop() {
kill -QUIT `cat $PIDFILE` || echo -n " not running"
}
rh_reload() {
kill -HUP `cat $PIDFILE` || echo -n " can't reload"
}
case "$1" in
start)
echo -n "Starting $DESC: $NAME"
rh_start
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
rh_stop
echo "."
;;
reload)
echo -n "Reloading $DESC configuration..."
rh_reload
echo "reloaded."
;;
restart)
echo -n "Restarting $DESC: $NAME"
rh_stop
sleep 1
rh_start
echo "."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|reload}" >&2
exit 3
;;
esac
exit 0
9.增加執行許可權:
[root@localhost etc]# chmod a+x /etc/init.d/php-fpm
10.把php-fpm加入chkconfig系統服務,開機自啟動
[root@localhost etc]# chkconfig php-fpm on
[root@localhost etc]# chkconfig php-fpm on
相關文章
- LNMP網站框架搭建(編譯安裝)LNMP網站框架編譯
- LNMP架構編譯安裝(Linux、Nginx、Mysql、PHP)LNMP架構編譯LinuxNginxMySqlPHP
- 1.8LNMP環境編譯安裝php-5.6.14LNMP編譯PHP
- Centos7編譯安裝OpenRestyCentOS編譯REST
- httpd編譯安裝phphttpd編譯PHP
- centos PHP 編譯安裝CentOSPHP編譯
- CentOS7編譯安裝php7.1配置教程詳解CentOS編譯PHP
- 如何在CentOS7安裝Node?(編譯安裝)CentOS編譯
- Centos7編譯安裝Apache教程。CentOS編譯Apache
- Centos7編譯安裝Memcached教程。CentOS編譯
- Centos7編譯安裝Docker教程。CentOS編譯Docker
- Centos7編譯安裝Tomcat教程。CentOS編譯Tomcat
- Linux 編譯 安裝 PHP 7.3.1Linux編譯PHP
- PHP7 編譯安裝PHP編譯
- Nginx 實踐案例(原始碼編譯安裝方式):利用LNMP搭建wordpress站點Nginx原始碼編譯LNMP
- centos7 編譯安裝imagemagick7.1CentOS編譯
- centos7編譯安裝python3CentOS編譯Python
- PHP Linux安裝擴充套件(編譯安裝)PHPLinux套件編譯
- Debian9(Stretch) 下編譯安裝LNMP環境編譯LNMP
- Debian9 (Stretch) 下編譯安裝 LNMP 環境編譯LNMP
- 編譯安裝nginx-php-mysql編譯NginxPHPMySql
- Centos 編譯安裝 PHP7.4.7CentOS編譯PHP
- LNMP--mysql php安裝配置LNMPMySqlPHP
- Centos7編譯安裝Pure-Ftpd教程。CentOS編譯FTP
- CentOS7編譯和安裝GCC7.5CentOS編譯GC
- Centos7編譯安裝kafka-manager教程CentOS編譯Kafka
- Centos7下原始碼編譯安裝apacheCentOS原始碼編譯Apache
- Cnetos7編譯安裝PHP教程。編譯PHP
- CentOS 下編譯安裝 PHP7.2CentOS編譯PHP
- PHP編譯安裝之Configure引數PHP編譯
- Skywalking PHP客戶端編譯安裝PHP客戶端編譯
- CentOS7 快速高效,簡單安裝 lnmpCentOSLNMP
- centos7使用yum安裝lnmp環境CentOSLNMP
- PHP編譯configure時常見錯誤,和PHP7.1.4 編譯安裝PHP編譯
- CentOS7安裝php、安裝MySqlCentOSPHPMySql
- LNMP之PHP安裝操作步驟LNMPPHP
- Centos7安裝(四)抓包工具wireshark原始碼編譯安裝CentOS原始碼編譯
- Centos7編譯安裝Redis 6.2.3 詳細教程CentOS編譯Redis
- Ubuntu 18.04系統編譯安裝PHP教程。Ubuntu編譯PHP