Articles of PHP的

PHP不logging脚本错误,尽pipephp.ini设置

我正在使用NGINX的PHP-FPM,并且我无法获得错误日志以正确使用PHP-FPM。 这是我的php.ini ,相关部分: error_reporting = 'E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE' error_log = /var/www/logs/php-scripts.error.log log_errors = 'On' display_errors = 'Off' display_startup_errors = 'Off' html_errors = 'Off' open_basedir = /var/www/html/:/var/www/.tmp/:/var/www/logs/ upload_tmp_dir = /var/www/.tmp www-pool.comf相关片段(由PHP-FPM主进程加载configuration): listen = 9000 user = www-data group = www-data request_slowlog_timeout = 10 slowlog = /var/log/php-fpm/$pool.slow.log chdir = /var/www/html access.log = /var/log/php-fpm/$pool.access.log […]

通过FastCGI连接从NGINX到PHP的时间

这里有一个32GB内存的六核心。 我有nginx 0.7.X和php5-fpm与php5.3(来自dotdeb.org)。 重要的configuration文件: nginx.conf user www-data; worker_processes 2; events { worker_connections 4096; } location ~ \.php$ { fastcgi_pass unix:/tmp/fcgi.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www$fastcgi_script_name; include fastcgi_params; } PHP5-fpm.conf <value name="listen_address">/tmp/fcgi.sock</value> <value name="max_children">1500</value> <value name="max_requests">5000</value> 就这样。 与阿普替补(ab -n 1000 -c 1000 http:// url .. )我可以在250ms内为1000个并发连接请求一个静态文件(大小为10kB)。 Document Path: /inc/helper-swf.js Document Length: 10217 bytes Concurrency Level: 1000 […]

configurationHAProxy + nginx + PHP-FPM执行Apache + mod_php

编辑 在VirtualBox上运行我的操作系统是个问题。 只要我的操作系统是磁盘上的本机,我就能看到性能的提升。 原版的 我读过很多人推荐HAProxy + nginx + PHP-FPM的Apache + mod_php。 我试图validation这是一个更有效的设置,但没有看到人们描述的结果。 (siege和ab)(Apache Benchmark)都表明,在任何数量的并发连接中,Apache每秒都能提供更好的响应,并且可以支持更多的连接。 我在VirtualBox上运行Ubuntu 11.04服务器。 它有10场演出,1344兆内存。 我用apt-get来安装上面提到的程序。 这里是相关的configuration文件,只包括重要的部分。 haproxy.cfg global maxconn 4096 user haproxy group haproxy daemon stats socket /var/run/haproxy.sock mode 0600 level admin defaults log global mode http option httplog option dontlognull retries 3 option redispatch maxconn 2000 contimeout 5000 clitimeout 50000 srvtimeout […]

NGINXconfiguration。 PHP框架与PATHINFO 404

我通常使用apache,并试图给NGINX。 我已经安装在我的Ubuntu开发机器上,并有几个不同的框架和网站设置和开发(codeigniter,symfony,laravel等)。 我得到的问题是,只有以.php结尾的path工作。 如果我尝试index.php/welcome/index它只是404s而不是加载index.php。 我已经尝试将cgi.fix_pathinfo设置为1和0。 这是我目前的(很多尝试)网站configuration。 server { listen 80; ## listen for ipv4; this line is default and implied #listen [::]:80 default_server ipv6only=on; ## listen for ipv6 root /my/path; index index.php index.html; # Make site accessible from http://localhost/ server_name localhost; #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # […]

'&'变成'&amp;' 当试图从URL获取内容

我用相同的algorithm运行我的WebServer几个月,在那里我通过使用这一行代码得到了一个URL的内容: $response = file_get_contents('http://femoso.de:8019/api/2/getVendorLogin?' . http_build_query(array('vendor'=>$vendor,'user'=>$login,'pw'=>$pw),'','&')); 但现在突然停止工作,现在一定有了变化。 在早些时候,URL看起来应该是: http://femoso.de:8019/api/2/getVendorLogin?vendor=100&user=test&pw=test 但现在我在我的nginx日志中得到一个错误,说我要求下面的URL返回403 http://femoso.de:8019/api/2/getVendorLogin?vendor=100&amp;user=test&amp;pw=test 我知道在目标服务器上发生了一些变化,但我认为这不应该影响到我? 我已经花了几个小时的阅读和search谷歌和Stackoverflow,但所有build议的方式为 urlencode()或htmlspecialchars()等… 没有为我工作。 为了您的信息,该环境是一个zend应用程序,在我的一端有一个nginx服务器,在另一端有一个带有apache的php webservice。 就像我说的那样,我的身边没有任何改变! 谢谢

如何正确configurationNginx的PHP(Yii框架和Zurmo)

我正在尝试在本地机器(Win8x64)上安装Zurmo CRM。 安装完所有要求后,我想开始实际安装。 问题是,似乎path不正确地从NGinx传递到FastCGI PHP。 这是我的Nginx服务configuration: server { listen 80; server_name zurmo.local; root html/zurmo.local; set $index "index.php"; charset utf-8; location / { index index.html $index; try_files $uri $uri/ /$index?$args; } location ~ ^/(protected|framework|themes/\w+/views) { deny all; } location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ { try_files $uri =404; } location ~ \.php { fastcgi_split_path_info ^(.+\.php)(.*)$; set $fsn /$index; if […]

推荐用于WordPress的高stream量网站的Nginxconfiguration

我们有一个基于Wordpress的网站,每天获得大约150万的综合浏览量。 有时最多的并发会话每分钟可达5000个用户。 我们有一个Web和一个数据库服务器。 两台机器的规格如下: CPU: 2 x Intel(R) Xeon(R) CPU X5650 @ 2.66GHz 12M Cache / 6 Cores / 12 Threads (x2) Memory: 24GB Drive(s)(size/GB) – 4x240gb SSDs RAID 10 我们在Nginx上运行,使用FastCGI,还使用APC进行caching,以及使用WP Super Cache的简单页面caching。 目前的Nginxconfiguration如下: worker_processes 24; worker_rlimit_nofile 200000; worker_connections 4000; FastCGI设置如下: FcgidMaxProcesses 200 FcgidProcessLifeTime 3600 MaxProcessCount 100 FcgidIOTimeout 400 FcgidIdleTimeout 600 FcgidIdleScanInterval 90 FcgidBusyTimeout 400 […]

优化Nginx

我使用Nginx作为RPS,并有服务器无法处理超过100个请求/秒的问题。 如果一个IP发送了这么多的请求,Nginx将为大家服务502错误。 这是我的。 这个规格的专用机器, 100 mbps(双向)。 双核CPU 5 GB内存Windows Server 2008 R2 Apache,PHP(作为模块)和MySQL在后面handelingdynamic内容。 Nginx在前面,并将请求传递给Apache。 服务器上的每个页面都是dynamic生成和优化的,没有MySQL负载等。每个页面大小在50KB以下。 响应时间/加载时间在0.6s以下。 所以一切都很快,直到有人打开任何软件并向服务器发送请求,当请求速率大约为100req / s时,它开始发送502错误。 请求永远不会到达Apache。 所以这不是一个Apache问题。 那台服务器能处理多less? 这里是Nginx CONF的样子, http { include 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 K:/logs/nginx/access.log main; sendfile off; server_tokens off; keepalive_timeout 65; server_names_hash_bucket_size 64; […]

Vagrant + Ubuntu 14.04 + Nginx + HHVM =缓慢+崩溃

根据我最后一个问题 ,我试图通过在HHVM下运行来加速Laravel。 这需要我更新我的服务器到64位,所以我现在运行Trusty64。 我通过deb包安装了HHVM和Nginx。 我不完全确定我的nginxconfiguration是否正确,我把它从网上刮掉了: server { listen 80 default_server; root /vagrant/public; index index.php index.html index.htm; server_name localhost; access_log /var/log/nginx/localhost.laravel-access.log; error_log /var/log/nginx/locahost.laravel-error.log error; charset utf-8; location / { try_files \$uri \$uri/ /index.php?\$query_string; } location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { log_not_found off; access_log off; } error_page 404 /index.php; include […]

通过FastCGI使用ExpressJS应用程序

刚刚开始处理NodeJSnetworking应用程序,并有一个基本的问题。 由于我来自PHP领域,我知道PHP有一个内置的HTTP服务器,但没有人实际使用它,我们使用nginx和在史前项目Apache作为HTTP服务器,当我进入ExpressJS我发现所有的例子谈论听ExpressJS打开的HTTP服务器(通过http NodeJS模块当然),但没有人谈论通过FastCGI(nginx的 – > FastCGI的(例如node-fastcgi ) – >我的ExpressJS应用程序)像我用PHP (nginx – > PHP-fpm – >我的PHP环境),我想知道为什么? 据我了解,NodeJS应用程序是非常快速,非阻塞I / O等,但有一个使用应用程序的安全漏洞,因为运行的服务在JavaScript环境中具有相同的公共资源,一个用户例如,可以与他人共享错误(或不)敏感信息。 让我们假设开发者犯了一个这样的错误: router.post('/set-user-cc', function(res){ global.user = new User({ creditCard: req.param('cc') }); }); 和其他用户做这样的要求: router.get('/get-user-cc', funciton(req, res){ res.json(global.user); }); 此时每个用户将获得用户的CC信息。 通过FastCGI使用我的ExpressJS应用程序将为每个HTTP请求打开一个干净的JavaScript环境,用户不会互相伤害。 很高兴听到NodeJS(networking)应用程序经验丰富的开发人员为什么没有人build议使用FastCGI解决scheme(search谷歌,几乎没有发现),如果是这样,为什么它太糟糕了? (ps这个例子只是为了certificate这个问题不是某个人真正做的事情,但是正如我们所知,很多愚蠢的人存在于宇宙中:) 谢谢!