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
相關文章
- centos7搭建lnmp編譯安裝nginx【二】CentOSLNMP編譯Nginx
- centos7下編譯安裝lnmpCentOS編譯LNMP
- 從零搭建LNMP環境(一) - 編譯原始碼安裝PHPLNMP編譯原始碼PHP
- LNMP網站框架搭建(編譯安裝)LNMP網站框架編譯
- LNMP架構編譯安裝(Linux、Nginx、Mysql、PHP)LNMP架構編譯LinuxNginxMySqlPHP
- LNMP—Nginx的編譯安裝LNMPNginx編譯
- LNMP編譯安裝配置+discuzLNMP編譯
- 1.8LNMP環境編譯安裝php-5.6.14LNMP編譯PHP
- [LNMP]Nginx-1.6.3編譯安裝LNMPNginx編譯
- lnmp環境安裝-原始碼編譯LNMP原始碼編譯
- Centos7編譯安裝OpenRestyCentOS編譯REST
- CentOS7編譯安裝php7.1配置教程詳解CentOS編譯PHP
- centos7搭建lnmp安裝二進位制mysql【三】CentOSLNMPMySql
- centos PHP 編譯安裝CentOSPHP編譯
- httpd編譯安裝phphttpd編譯PHP
- PHP的編譯安裝PHP編譯
- 如何在CentOS7安裝Node?(編譯安裝)CentOS編譯
- Centos7編譯安裝Apache教程。CentOS編譯Apache
- Centos7編譯安裝Memcached教程。CentOS編譯
- Centos7編譯安裝Docker教程。CentOS編譯Docker
- Nginx 實踐案例(原始碼編譯安裝方式):利用LNMP搭建wordpress站點Nginx原始碼編譯LNMP
- PHP7 編譯安裝PHP編譯
- 編譯安裝php7編譯PHP
- php7編譯安裝PHP編譯
- php5.5.38編譯安裝PHP編譯
- PHP編譯安裝引數PHP編譯
- 編譯安裝php5.6.2編譯PHP
- Centos7編譯安裝Tomcat教程。CentOS編譯Tomcat
- centos7 編譯安裝imagemagick7.1CentOS編譯
- Centos 編譯安裝 PHP7.4.7CentOS編譯PHP
- Linux 編譯 安裝 PHP 7.3.1Linux編譯PHP
- 編譯安裝nginx-php-mysql編譯NginxPHPMySql
- [LAMP]Php-5.3.29編譯安裝LAMPPHP編譯
- LNMP--mysql php安裝配置LNMPMySqlPHP
- LNMP 原始碼安裝搭建薦LNMP原始碼
- Centos7編譯安裝kafka-manager教程CentOS編譯Kafka
- CentOS7編譯和安裝GCC7.5CentOS編譯GC
- Centos7下原始碼編譯安裝apacheCentOS原始碼編譯Apache