centos7 安装 php7

yum update
yum -y install epel-release
rpm -Uvh https://mirrors.ustc.edu.cn/centos/7/extras/x86_64/Packages/epel-release-7-6.noarch.rpm
yum search php7

yum install -y php72w-cli php72w-common php72w-dba php72w-devel php72w-embedded php72w-enchant php72w-fpm php72w-gd php72w-imap php72w-interbase php72w-intl php72w-ldap php72w-mbstring php72w-mysql php72w-mysqlnd php72w-odbc php72w-opcache php72w-pdo php72w-pdo_dblib php72w-pear.noarch php72w-pecl-apcu php72w-pecl-apcu-devel php72w-pecl-geoip php72w-pecl-igbinary php72w-pecl-igbinary-devel php72w-pecl-imagick php72w-pecl-imagick-devel php72w-pecl-libsodium php72w-pecl-memcached php72w-pecl-mongodb php72w-pecl-redis php72w-pecl-xdebug php72w-pgsql php72w-phpdbg php72w-process php72w-pspell php72w-recode php72w-snmp php72w-soap php72w-tidy php72w-xml php72w-xmlrpc --skip-broken

===============================================

mkdir /tmp/session
chown -R nobody:nobody /tmp/session
chmod -R 755 /tmp/session

sed -i 's|short_open_tag = Off|short_open_tag = On|g' /etc/php.ini
sed -i 's|;date.timezone =|date.timezone = Asia/Shanghai|g' /etc/php.ini
sed -i 's|;session.save_path = "/tmp"|session.save_path = "/tmp/session"|g' /etc/php.ini
sed -i 's|memory_limit = 128M|memory_limit = 300M|g' /etc/php.ini
sed -i 's|post_max_size = 8M|post_max_size = 80M|g' /etc/php.ini
sed -i 's|upload_max_filesize = 2M|upload_max_filesize = 20M|g' /etc/php.ini

sed -i 's|user = apache|user = nobody|g' /etc/php-fpm.d/www.conf
sed -i 's|group = apache|group = nobody|g' /etc/php-fpm.d/www.conf
sed -i 's|;listen.owner = nobody|listen.owner = nobody|g' /etc/php-fpm.d/www.conf
sed -i 's|;listen.group = nobody|listen.group = nobody|g' /etc/php-fpm.d/www.conf

service php-fpm start

ps -ef|grep php

===============================================

location / {
	try_files $uri $uri/ /index.php?$args;
}

location ~ .*\.php {
	fastcgi_pass 127.0.0.1:9000;	
	fastcgi_keep_conn on;
	fastcgi_index index.php;
	include fastcgi_params;

	set $script    $uri;
	set $path_info  "/";
	if ($uri ~ "^(.+\.php)(/.+)") {
		set $script     $1;
		set $path_info  $2;
	}

	fastcgi_param PATH_INFO $path_info;
	fastcgi_param SCRIPT_FILENAME  $document_root/$script;
	fastcgi_param SCRIPT_NAME $script;
}

猜你喜欢

转载自my.oschina.net/qiongtaoli/blog/1630112