contos安裝php+nginx

 

yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers gd gd2 gd-devel gd2-devel perl-CPAN pcre-devel

rpm -ivh "http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm"

yum install libmcrypt-devel

./configure --prefix=/usr/local/php --with-config-file-path=/etc/php --enable-fpm --enable-pcntl --enable-mysqlnd --enable-opcache --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-shmop --enable-zip --enable-ftp --enable-soap --enable-xml --enable-mbstring --disable-rpath --disable-debug --disable-fileinfo --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-pcre-regex --with-iconv --with-zlib --with-mcrypt --with-gd --with-openssl --with-mhash --with-xmlrpc --with-curl --with-imap-ssl

sudo make
sudo make install
sudo cp php.ini-development /etc/php/php.iniphp

cp /usr/local/php/etc/php-fpm.conf.default  /usr/local/php/etc/php-fpm.confmysql

加環境變量
vim ~/.bashrc
加入
export PATH=/usr/local/php/bin:$PATH
export PATH=/usr/local/php/sbin:$PATH
執行
source ~/.bashrcc++

注意sql

1 /usr/local/php/etc/php-fpm.d 這裏有個www文件,也要cp下vim

2 修改這個www文件,php-fpm運行時的用戶,切記必定要處理api

保存配置文件後,檢驗配置是否正確的方法爲:bash

sudo /usr/local/php/sbin/php-fpm -t
若是出現諸如 「test is successful」 字樣,說明配置沒有問題。curl


phpize位置
/usr/local/php/bin/phpizesocket

啓動php-fpmphp-fpm

cp /usr/local/src/php-5.3.27/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod 755 /etc/init.d/php-fpm
service php-fpm start

若是想讓它開機啓動,執行:

chkconfig php-fpm on

檢測是否啓動:

ps aux |grep php-fpm
netstat -ant |grep 9000
相關文章
相關標籤/搜索