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
执行命令安装Php7
yum install php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-mysql.x86_64 php70w-pdo.x86_64
安装php-fpm
yum -y install php70w-fpm php70w-opcache
启动php-fpm
systemctl start php-fpm
nginx 配置
server {
listen 80;
# listen [::]:80 default_server;
server_name u.domain.com
root /root/html;
index index.php index.html index.htm;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location ~ \.php?.*$ {
fastcgi_pass 127.0.0.1:9000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
access_log /var/log/nginx/u_access.log;
error_log /var/log/nginx/u_error.log;
}
rpm -Uvh http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
yum repolist all | grep mysql
yum -y install mysql-community-server
安装完成后在/var/log/mysqld.log
生成了默认密码,通过以下方式找到
grep 'temporary password' /var/log/mysqld.log
Mac OS 自带apache
sudo apachectl restart
打开浏览器,在地址栏中输入localhost,出现It Works字符串,就说明Apache已经成功启动.
在Macbook pro下,Apache的网站服务器根目录在/Library/WebServer/Documents
路径下
apache配置目录: /private/etc/apache2
.
配置php
打开/private/etc/apache2
下的httpd.conf, 搜索#LoadModule php5_module libexec/apache2/libphp5.so
,将#
删除.
新建info.php:
<?php
phpinfo();
?>
<IfDefine SERVER_APP_HAS_DEFAULT_PORTS>
Listen 8989
</IfDefine>
<IfDefine !SERVER_APP_HAS_DEFAULT_PORTS>
Listen 89
</IfDefine>
打开http://localhost:89/info.php
DocumentRoot "/Users/marstau/projects/marsmon/php-marsmon"
<Directory "/Users/marstau/projects/marsmon/php-marsmon">
</Directory>