安装php,yum安装的版本只有5.1,所以手动安装
- 百度云下载 php-5.6.16.tar.gz:https://pan.baidu.com/s/1eSxfhXg
tar -xzvf php-5.6.16.tar.gz
- 安装
libxml2
: yum install libxml2-devel - 安装
bzip2
: yum install bzip2 bzip2-devel - 安装
curl
: yum -y install curl-devel - 安装
libpng
:yum install libpng libpng-devel - 安装
libmcrypt
:yum install libmcrypt libmcrypt-devel - 安装
readline
: yum -y install readline readline-devel - 执行下面的配置
./configure --prefix=/usr/local/php --with-config-file-path=/etc --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-opcache --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-gettext --enable-mbstring --with-iconv --with-mcrypt --with-mhash --with-openssl --enable-bcmath --enable-soap --enable-pcntl --enable-shmop --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-sockets --with-curl --with-zlib --enable-zip --with-bz2 --with-readline --without-sqlite3 --without-pdo-sqlite --with-pear --with-gd
- 复制php-fpm.conf
cp /opt/lib/php-5.6.28/sapi/fpm/php-fpm.conf /usr/local/php/etc/php-fpm.conf
- php-fpm 全局启动
cp /usr/local/php/sbin/php-fpm /usr/local/bin/php-fpm
12.启动 php-fpm
13.新建index.php
<?php
phpinfo();
14.成功
安装nginx
- yum 安装
yum -y install nginx
- 删除 /etc/nginx/conf.d下所有文件
- 配置自己的服务
vim mysite.conf
server {
charset utf-8;
client_max_body_size 128M;
listen 80;
server_name www.wexue.top;
root /opt/server/gmfitness-wx;
index index.php index.html;
access_log /opt/log/access.log;
error_log /opt/log/error.log;
location / {
# Redirect everything that isn't a real file to index.php
try_files $uri $uri/ /index.php$is_args$args;
}
#转发
location /wxnotify {
proxy_pass http://XXXXX/index.php?g=Restful&m=Vip&a=wxnotify;
}
# uncomment to avoid processing of calls to non-existing static files by Yii
#location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
# try_files $uri =404;
#}
#error_page 404 /404.html;
location ~ \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/var/run/php5-fpm.sock;
try_files $uri =404;
}
location ~ /\.(ht|svn|git) {
deny all;
}
}
- 启动:yum自动安装了nginx的服务,
service nginx start
安装mysql
- yum安装
yum -y install mysql-server mysql mysql-devel
service mysqld start
- 开机启动
chkconfig mysqld on
chkconfig --list | grep mysql
- 密码设置
mysqladmin -u root password '密码'
- 设置全网访问
mysql -uroot -p
- 输入:
use mysql
; - 查询host输入:
select user,host from user
; - 创建host(如果有"%"这个host值,则跳过这一步)
- 如果没有"%"这个host值,就执行下面这两句:
mysql> update user set host='%' where user='root';
mysql> flush privileges;
- 授权用户
- 任意主机以用户root和密码pwd连接到mysql服务器
- 指定IP为(如192.168.1.100)的主机以用户tuser和密码tpwd连接到mysql服务器
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;
mysql> flush privileges;
mysql> GRANT ALL PRIVILEGES ON *.* TO 'tuser'@'192.168.1.100' IDENTIFIED BY '密码' WITH GRANT OPTION;
mysql> flush privileges;
网友评论