分享下CentOS 6.5 搭建PHP情況(Nginx+MariaDB+PHP7)的心得條記,,有什么差池的處所,還請列位大大指出。
1.mariaDb
vim /etc/yum.repos.d/MariaDB.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/centos5-x86
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
sudo yum install MariaDB-server MariaDB-client
#啟動MariaDB
sudo /etc/init.d/mysql start
通過在建設MariaDB.repo,可以實現yum安裝
對應差異linux版本設置文件,和具體要領可以參考下面鏈接
https://mariadb.com/kb/zh-cn/installing-mariadb-with-yum/
https://downloads.mariadb.org/mariadb/repositories/#mirror=opencas
2.nginx
#此呼吁可以一鍵安裝開拓東西包
yum -y groupinstall "Development Tools" "Development Libraries"
#建設www組與www用戶
groupadd www
useradd -g www -s /usr/sbin/nologin www
# 安裝Nginx
tar zxvf nginx-1.9.9.tar.gz
cd nginx-1.9.9.tar.gz/
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
make && make install
#啟動Nginx
/usr/local/nginx/sbin/nginx
#測試設置文件是否正確
/usr/local/nginx/sbin/nginx -t
還可以通過service呼吁來操縱nginx處事,如下
1.先建設一個文件,內里寫入以下shell劇本如:
進入編輯模式并復制以下內容:查察nginx.shell文件
#!/bin/bash
# nginx Startup script for the Nginx HTTP Server
#
# chkconfig: - 85 15
# description: Nginx is a high-performance web and proxy server.
# It has a lot of features, but it's not for everyone.
# processname: nginx
# pidfile: /var/run/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf
nginxd=/usr/local/nginx/sbin/nginx
nginx_config=/usr/local/nginx/conf/nginx.conf
nginx_pid=/var/run/nginx.pid
RETVAL=0
prog="nginx"
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -x $nginxd ] || exit 0
# Start nginx daemons functions.
start() {
if [ -e $nginx_pid ];then
echo "nginx already running...."
exit 1
fi
echo -n $"Starting $prog: "
daemon $nginxd -c ${nginx_config}
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
return $RETVAL
}
# Stop nginx daemons functions.
stop() {
echo -n $"Stopping $prog: "
killproc $nginxd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /var/run/nginx.pid
}
# reload nginx service functions.
reload() {
echo -n $"Reloading $prog: "
#kill -HUP `cat ${nginx_pid}`
killproc $nginxd -HUP
RETVAL=$?
echo
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
stop
start
;;
status)
status $prog
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|reload|status|help}"
exit 1
esac
exit $RETVAL
2.把這個文件復制到/etc/init.d目次下
#cp ./nginx /etc/init.d
3.修改這個文件為可執行的權限
#chmod +x /etc/init.d/nginx
4.把這個可執行文件加隨處事處事中去
#chkconfig --add nginx
之后就可以利用 service 呼吁來打點了!
3.php
#安裝前先更新所需要的模塊
# yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel mysql pcre-devel
# wget https://downloads.php.net/~ab/php-7.0.0RC1.tar.gz
# tar zxvf php-7.0.0RC1.tar.gz
# cd php-7.0.0RC1
# ./configure --prefix=/usr/local/php
--with-curl
--with-freetype-dir
--with-gd
--with-gettext
--with-iconv-dir
--with-kerberos
--with-libdir=lib64
--with-libxml-dir
--with-mysqli
--with-openssl
--with-pcre-regex
--with-pdo-mysql
--with-pdo-sqlite
--with-pear
--with-png-dir
--with-xmlrpc
--with-xsl
--with-zlib
--enable-fpm
--enable-bcmath
--enable-libxml
--enable-inline-optimization
--enable-gd-native-ttf
--enable-mbregex
--enable-mbstring
--enable-opcache
--enable-pcntl
--enable-shmop
--enable-soap
--enable-sockets
--enable-sysvsem
--enable-xml
--enable-zip
# 編譯安裝
# make && make install