banner
阿珏酱

阿珏酱

いつもとは逆の電車に乗り、見たこともない風景を見に行く
twitter
github
facebook
bilibili
zhihu
steam_profiles
youtube

在Linux下安裝PHP環境

提示:當你看到這個提示的時候,說明當前的文章是由原emlog博客系統搬遷至此的,文章發布時間已過於久遠,編排和內容不一定完整,還請諒解`

Linux 下安裝 PHP 環境

日期:2018-5-7 阿珏 教程 瀏覽:2016 次 評論:0 條

學習環境:Centos 7.2 正式版_64 位

# 更新源
yum update

# 安裝nginx
yum install nginx -y

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

# 安裝PHP7.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

# 啟動服務
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 &

# 編輯配置文件
vim /etc/nginx/nginx.conf
:q! #不保存退出
:wq #保存退出

# 1、編輯/etc/nginx
#/nginx.conf,啟用如下選項:
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、在所支持的主頁面格式中添加php格式的主頁,類似如下:
location / {
	root   html;
	index  index.php index.html index.htm;
}
# 3、編輯/etc/nginx/fastcgi_params,將其內容更改為如下內容:
# 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、重新載入nginx的配置文件:
nginx -t               
service nginx reload 


# 停止nginx
nginx -s stop

# 卸載nginx
yum remove nginx 

# 推送文件
cd /usr/share/nginx/html
lcd C:\DirName
put FileName.zip

# zip命令
#  解壓:
unzip FileName.zip

#  壓縮:
zip FileName.zip DirName
載入中......
此文章數據所有權由區塊鏈加密技術和智能合約保障僅歸創作者所有。