我需要重新加载我的 php.ini 并且帮助对话框中没有关于重新启动它的任何内容。
我第一次使用 Nginx,但我对 Apache 和 Linux 非常熟悉。我正在使用一个现有的项目,当我试图查看 index.php 时,我得到一个 404 文件未找到。
这是 access.log 条目:
2013/06/19 16:23:23 [error] 2216#0: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.ordercloud.lh"
Run Code Online (Sandbox Code Playgroud)
这是网站可用的文件:
server {
set $host_path "/home/willem/git/console/www";
access_log /www/logs/console-access.log main;
server_name console.ordercloud;
root $host_path/htdocs;
set $yii_bootstrap "index.php";
charset utf-8;
location / {
index index.html $yii_bootstrap;
try_files $uri $uri/ /$yii_bootstrap?$args;
}
location ~ ^/(protected|framework|themes/\w+/views) {
deny all;
}
#avoid …Run Code Online (Sandbox Code Playgroud) 很少有不同的php“包装器”(?)。它们之间有什么区别?试图谷歌一些,但似乎无法找到信息。(mod-php 不能用谷歌搜索)。
为什么我可以选择一个而不是另一个?
已经有一个 很大 的 谈论关于相对于一个安全问题cgi.fix_pathinfo与Nginx的(通常是PHP-FPM,快速CGI)使用PHP选项。
结果,默认的 nginx 配置文件曾经说:
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
Run Code Online (Sandbox Code Playgroud)
但是,现在,“官方”Nginx wiki声明无需禁用上述 PHP 选项即可正确处理 PATH_INFO。所以呢?
cgi.fix_pathinfo什么的吗?(官方文档只是说:“有关 PATH_INFO 的更多信息,请参阅 CGI 规范”)PATH_INFO和SCRIPT_FILENAME变量做什么?我试图在每一步都理解这个问题。例如,我不明白为什么使用 php-fpm Unix 套接字可以避免这个问题。
我有Nginx + php5-fpm。我的网站每小时卡住几次,在日志文件中我看到以下内容:
警告:[pool www] 服务器达到 pm.max_children 设置 (5),请考虑提高它。
/etc/php5/fpm/pool.d/www.conf文件包含如下配置:
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
Run Code Online (Sandbox Code Playgroud)
服务器: AMD Opteron™ 3280,八核,8x 2.4 GHz,16 GB DIMM (DDR3)。
我不知道应该在该服务器的 www.conf 文件中输入什么数字。我可以帮助别人吗?谢谢
目前在 CentOS 6.5 上运行 PHP 5.4。
我安装了 webtatic php55w 包,然后通过 PECL 安装了 PEAR+PECL 以及 redis 和 mongo,没有问题。
不久之后,我意识到 5.5 与我正在使用的框架不兼容,所以我 yum 删除了 php55w 并在它的位置安装了 php54w。
现在 pecl 命令根本不起作用。每次我发出任何 pecl 命令时,它都会产生一串非常长的错误(缩写......最多重复几十次):
Warning: Invalid argument supplied for foreach() in Command.php on line 259
Warning: Invalid argument supplied for foreach() in /usr/share/pear/PEAR/Command.php on line 259
...etc etc etc...
Notice: Undefined index: honorsbaseinstall in Role.php on line 180
Notice: Undefined index: honorsbaseinstall in Role.php on line 180
...etc etc etc...
Notice: Undefined index: installable …Run Code Online (Sandbox Code Playgroud) 我这里有一个奇怪的问题。我刚刚从 apache + mod_php 转移到 nginx + php-fpm。除了这个问题,一切都很好。
我有一个网站,比如说example.com。当我像example.com?test=get_param $_SERVER['REQUEST_URI']is一样访问它时/?test=get_param,还有一个$_GET['test']。
但是,当我访问example.com/ajax/search/?search=get_param $_SERVER['REQUEST_URI']时/ajax/search/?search=get_param仍然没有$_GET['search'](有没有$_GET在所有的阵列)。
我正在使用 Kohana 框架。哪个路由/ajax/search到控制器,但我已经把它phpinfo()放在index.php所以我$_GET在框架做任何事情之前检查变量(这意味着消失的获取参数不是框架的错误)。
我的nginx.conf是这样的
worker_processes 4;
pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
index index.html index.php;
autoindex on;
autoindex_exact_size off;
include mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 128;
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 logs/access.log main;
error_log …Run Code Online (Sandbox Code Playgroud) 我最近在本地机器上安装了 Apache 2.4,以及使用 PHP-FPM 的 PHP 5.4.8。
一切都很顺利(过了一会儿......)但仍然有一个奇怪的错误:
我像这样为 PHP-FPM 配置了 Apache:
<VirtualHost *:80>
ServerName localhost
DocumentRoot "/Users/apfelbox/WebServer"
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/Users/apfelbox/WebServer/$1
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
它有效,例如,如果我打电话给http://localhost/info.php我得到正确的phpinfo()(它只是一个测试文件)。
但是,如果我调用目录,则会File not found.在错误日志中收到带有正文的 404 :
[Tue Nov 20 21:27:25.191625 2012] [proxy_fcgi:error] [pid 28997] [client ::1:57204] AH01071: Got error 'Primary script unknown\n'
Run Code Online (Sandbox Code Playgroud)
我现在尝试使用 mod_rewrite 进行代理:
<VirtualHost *:80>
ServerName localhost
DocumentRoot "/Users/apfelbox/WebServer"
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/Users/apfelbox/WebServer/$1 [L,P]
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
但问题是:它总是重定向,因为http://localhost/自动http://localhost/index.php请求,因为
DirectoryIndex index.php index.html
Run Code Online (Sandbox Code Playgroud)
调试 6 小时后 - 我放弃了:|
我们在 LAN 中有一个 nginx+php-fpm+mysql,有近 100 个 wordpress(由不同的设计人员/开发人员创建和使用,他们都在测试 wordpres 设置)
我们长期使用 nginx 没有任何问题。
今天,突然间——nginx开始突然返回“504网关超时”......
我检查了虚拟主机的 nginx 错误日志...
2010/09/06 21:24:24 [error] 12909#0: *349 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 192.168.0.1, server: rahul286.rtcamp.info, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "rahul286.rtcamp.info"
2010/09/06 21:25:11 [error] 12909#0: *349 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 192.168.0.1, server: rahul286.rtcamp.info, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: …Run Code Online (Sandbox Code Playgroud) 我在 Ubuntu 14.04 上的 Nginx 下运行 php5-fpm。我想增加最大上传大小。
我已经编辑了我/etc/php5/fpm/php.ini的以下几行定义如下:
upload_max_filesize = 20M
post_max_size = 25M
我重新启动了 php5-fpm 和 nginx,但phpinfo()仍然分别显示了 8M 和 2M 的发布和上传限制。
我在这里错过了什么吗?