banner
阿珏酱

阿珏酱

乘上与平常相反的电车,去看看那未曾见过的风景
twitter
github
facebook
bilibili
zhihu
steam_profiles
youtube

Installing PHP environment on Linux

Tips: When you see this prompt, it means that the current article has been migrated from the original emlog blog system. The publication date of the article is too old, and the formatting and content may not be complete. Please understand.

Installing PHP Environment on Linux

Date: 2018-5-7 Author: Ajue Views: 2016 Comments: 0

Learning Environment: CentOS 7.2 Official Edition_64-bit

# Update source
yum update

# Install nginx
yum install nginx -y

# Install mysql
wget https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm
yum localinstall mysql57-community-release-el7-11.noarch.rpm

# Install PHP 7.2
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum update
yum install -y php72w-cli php72w-common php72w-dba php72w-devel php72w-fpm php72w-gd php72w-imap php72w-mbstring php72w-mysql php72w-pdo php72w-pdo_dblib php72w-pear php72w-pecl-igbinary php72w-pecl-xdebug php72w-process php72w-xml php72w-xmlrpc php72w-opcache php72w-pecl-memcached php72w-pecl-mongodb php72w-pecl-redis

# Start services
service nginx start
service mysql start
service php-fmp start
/usr/sbin/php-fpm --nodaemonize --fpm-config /etc/php-fpm.conf > /dev/null 2>&1 &

# Edit configuration file
vim /etc/nginx/nginx.conf
:q! #Exit without saving
:wq #Save and exit

# 1. Edit /etc/nginx/nginx.conf, enable the following options:
location ~ \.php$ {
	root           html;
	fastcgi_pass   127.0.0.1:9000;
	fastcgi_index  index.php;
	fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
	include        fastcgi_params;
}
# 2. Add php format homepage in supported main page formats, similar to the following:
location / {
	root   html;
	index  index.php index.html index.htm;
}
# 3. Edit /etc/nginx/fastcgi_params, change its content to the following:
# cp /etc/nginx/fastcgi_params /etc/nginx/fastcgi_params.bk
# cat /dev/null>/etc/nginx/fastcgi_params
# vim /etc/nginx/fastcgi_params
fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx;
fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;
fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

# 4. Reload nginx configuration file:
nginx -t               
service nginx reload 


# Stop nginx
nginx -s stop

# Uninstall nginx
yum remove nginx 

# Push files
cd /usr/share/nginx/html
lcd C:\DirName
put FileName.zip

# zip command
#   Unzip:
unzip FileName.zip

#   Compress:
zip FileName.zip DirName
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.