https://www.zybuluo.com/phper/note/79313
yum install -y make cmake gcc gcc-c++ autoconf automake libpng-devel libjpeg-devel zlib libxml2-devel ncurses-devel bison libtool-ltdl-devel libiconv libmcrypt mhash mcrypt pcre-devel openssl-devel freetype-devel libcurl-devel gmp-devel
# 先下载 PHP
cd /
mkdir software
cd /software
wget http://cn2.php.net/distributions/PHP-5.6.6.tar.gz
tar -zxvf PHP-5.6.6.tar.gz
cd PHP-5.6.6
# 我们先配置下 PHP 的编译参数
./configure --prefix=/usr/local/PHP --with-MySQL --with-mysqli --with-pdo_MySQL --with-iconv-dir --with-zlib --with-libxml-dir --enable-xml --with-curl --enable-fpm --enable-mbstring --with-gd --with-gmp --with-openssl --with-mhash --enable-sockets --with-xmlrpc --enable-zip --enable-SOAP --with-freetype-dir=/usr/lib64
# 编译
make
make install clean
# 复制 php.ini
cp php.ini-development /usr/local/PHP/lib/php.ini
cp /usr/local/PHP/etc/PHP-fpm.conf.default /usr/local/PHP/etc/PHP-fpm.conf
# 运行 PHP-fpm
/usr/local/PHP/sbin/PHP-fpm
# 将 PHP 命令加入到全局
vi /root/.bash_profile
# 将 /usr/local/PHP/bin 加到后面,用:隔开
PATH=$PATH:$HOME/bin:/usr/local/PHP/bin
# 重启
source /root/.bash_profile
先卸载老版本:
# 查看老版本号
[root@CentOS6 /]# rpm -qa|grep -i MySQL
MySQL-libs-5.1.71-1.el6.x86_64
# 无依赖卸载删除
[root@CentOS6 /]# rpm -ev --nodeps MySQL-libs-5.1.71-1.el6.x86_64
# 检查下还存在否?
[root@CentOS6 /]# rpm -qa|grep -i MySQL
[root@CentOS6 /]# rpm -q MySQL
package MySQL is not installed
再安装新版本:
cd /software
# 先下载 MySQL 5.6
wget https://cdn.mysql.com/archives/MySQL-5.6/MySQL-5.6.23.tar.gz
tar zxvf MySQL-5.6.23.tar.gz
cd MySQL-5.6.23
#cmake 配置下
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/MySQL \ # 安装目录
-DMYSQL_DATADIR=/usr/local/MySQL/data \ # 数据库存放目录
-DDEFAULT_CHARSET=utf8 \ # 使用 utf8 字符
-DDEFAULT_COLLATION=utf8_general_ci \ # 校验字符
-DEXTRA_CHARSETS=all \ # 安装所有扩展字符集
-DENABLED_LOCAL_INFILE=1 # 允许从本地导入数据
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/MySQL -DMYSQL_DATADIR=/usr/local/MySQL/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DENABLED_LOCAL_INFILE=1
# 编译安装
make && make install
# 创建 MySQL 用户和用户组
groupadd MySQL
useradd -r -g MySQL MySQL
# 给 MySQL 目录设置目录权限
chown -R MySQL:MySQL /usr/local/MySQL
# 将 MySQL 的启动服务添加到系统服务中
cd /usr/local/MySQL/
cp support-files/my-default.cnf /etc/my.cnf
# 创建系统数据库的表
cd scripts/
./MySQL_install_db --user=MySQL --basedir=/usr/local/MySQL --datadir=/usr/local/MySQL/data/
# 复制 MySQL 管理脚本到系统服务目录
cd /usr/local/MySQL/support-files
cp mysql.server /etc/rc.d/init.d/MySQL
# 添加 MySQL 命令到系统服务命令
chkconfig --add MySQL
# 加入开机启动策略
chkconfig MySQL on
service MySQL start
# 以后就可以调用 service 命令来管理 MySQL
service MySQL start
service MySQL stop
service MySQL restart
# 将 MySQL 命令加入全局可用
vi /root/.bash_profile
# 在 PATH=$PATH:$HOME/bin 添加参数为:
PATH=$PATH:$HOME/bin:/usr/local/PHP/bin:/usr/local/MySQL/bin:/usr/local/MySQL/lib
# 重新生效
source /root/.bash_profile
# 修改 root 密码
service MySQL start
MySQL -uroot
MySQL>use MySQL;
MySQL>desc user;
MySQL> GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "root"; // 为 root 添加远程连接的能力。
MySQL>update user set Password = password ('test87@23#') where User='root';
MySQL>select Host,User,Password from user where User='root';
MySQL>flush privileges;
MySQL>exit
# 重新登录:
MySQL -uroot -p123456
```bash
#### 安装 nginx
```bash
第一步,在 /etc/yum.repos.d/ 目录下创建一个源配置文件 nginx.repo:
cd /etc/yum.repos.d/
VIM nginx.repo
填写如下内容:
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/CentOS/$releasever/$basearch/
gpgcheck=0
enabled=1
保存,则会产生一个 /etc/yum.repos.d/nginx.repo 文件。
yum install nginx
配置 /etc/nginx/nginx.conf
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {worker_connections 1024;}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local]"$request"''$status $body_bytes_sent "$http_referer" ''"$http_user_agent""$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
fastcgi_buffers 8 16 k;
fastcgi_buffer_size 32 k;
#gzip on;
include /etc/nginx/conf.d/*.conf;
配置 /etc/nginx/conf.d/zhong.conf
server {
listen 80;
server_name www.xmyunce.com;
root /usr/share/nginx/HTML/zhong/public;
index index.html index.htm index.php;
#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;
location / {try_files $uri $uri/ /index.php?$query_string;}
#error_page 404 /404.html;
# redirect server error pages to the static page /50 x.html
#
error_page 500 502 503 504 /50 x.html;
#location = /50 x.html {
# root /usr/share/nginx/HTML;
#}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#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;
#}
location ~ \.php$ {fastcgi_split_path_info ^(.+\.php)(/.+)$;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
# With PHP5-CGI alone:
fastcgi_pass 127.0.0.1:9000;
# With PHP5-fpm:
# fastcgi_pass unix:/var/run/PHP-fpm/www.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
删除 conf.d 目录下其它的文件
安装 Composer
http://www.cnblogs.com/jackspider/p/6292432.html
1. 安装 Composer
curl -sS https://getcomposer.org/installer | PHP
2. 添加到环境变量
mv composer.phar /usr/local/bin/Composer
ln -s /usr/local/PHP /usr/local/bin/PHP
1. 创建仓库
进入 /usr/share/nginx/HTML
Git clone https://edison2017@bitbucket.org/edison2017/zhong.git
Git pull 免密码拉取
进入 /usr/share/nginx/HTML/zhong
Git remote set-url origin https://edison2017:xxxx@bitbucket.org/edison2017/zhong.git
Git remote set-url origin https://lindon888:xxxx@bitbucket.org/feifeixia/feifeixia.git
创建数据库
CREATE DATABASE zhong DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
导入数据库
MySQL -uroot -p
use zhong
source /usr/share/nginx/HTML/zhong/zhong.sql
service iptables stop
chkconfig iptables off(设置自动启动为关闭)
chkconfig iptables on(设置自动启动为启动)
chkconfig --del iptables(移除开启自启动)
chkconfig --add iptables(增加开启自启动)
http://bguncle.blog.51 cto.com/3184079/957315/
查看 SELinux 状态:
1、/usr/sbin/sestatus -v ## 如果 SELinux status 参数为 enabled 即为开启状态
SELinux status: enabled
2、getenforce ## 也可以用这个命令检查
关闭 SELinux:
1、临时关闭(不用重启机器):
setenforce 0 ## 设置 SELinux 成为 permissive 模式
##setenforce 1 设置 SELinux 成为 enforcing 模式
2、修改配置文件需要重启机器:
修改 /etc/selinux/config 文件
将 SELINUX=enforcing 改为 SELINUX=disabled
重启机器即可
chmod -R 777 Bootstrap/cache
chmod -R 777 storage
.env (copy)
Composer install