我想执行PHP文件与php56和Nginx的brew安装。如何使用php56和Nginx为OSX执行php文件?
brew install nginx brew install php56
所以,/usr/local/etc/nginx/nginx.conf
在这里。
worker_processes 1;
error_log /usr/local/var/log/nginx/error.log;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
server_name localhost;
listen 8080;
root /Users/kent/work;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
include servers/*;
}
我做一个目录/Users/kent/work/html
一个HTML文件index.html
。
<h1>this is my first file!</h1>
它在http://localhost:8080/html/index.html
工作。
我做一个目录/Users/kent/work/php
与php文件index.php
。
<?php phpinfo();
它并没有在http://localhost:8080/php/index.php
浏览。 奇怪的是它使得下载index.php文件。
我应该在浏览器中浏览php信息。 我做错了什么?你会提出一些建议吗?
非常感谢您的支持!但是,如果我命令php-fpm -v,'我的控制台返回PHP 5.6.23(fpm-fcgi)(构建时间:Jul 24 2016 11:25:06)(DEBUG)版权所有(c)1997-2016 PHP Group Zend Engine v2.6.0,版权所有(c)1998-2016 Zend Technologies'。所以php-fpm已经安装,但有些问题。 –
@KentFujii php-fpm启动并且它正在监听端口9000,你可以使用'$ lsof -Pni4 | grep LISTEN | grep php' –