banner
阿珏酱

阿珏酱

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

Linux下安装PHP环境

Tips:当你看到这个提示的时候,说明当前的文章是由原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
加载中...
此文章数据所有权由区块链加密技术和智能合约保障仅归创作者所有。