<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>php on 老王的日志</title>
    <link>http://superwf.github.io/categories/php/</link>
    <description>Recent content in php on 老王的日志</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>zh-CN</language>
    <lastBuildDate>Wed, 30 Jul 2014 08:35:58 +0000</lastBuildDate>
    
	<atom:link href="http://superwf.github.io/categories/php/index.xml" rel="self" type="application/rss+xml" />
    
    
    <item>
      <title>最近又看了看php,做了几个ab的测试</title>
      <link>http://superwf.github.io/p906/</link>
      <pubDate>Wed, 30 Jul 2014 08:35:58 +0000</pubDate>
      
      <guid>http://superwf.github.io/p906/</guid>
      <description>最近折腾服务器部署，感觉rails占内存多有时候需要重启服务才能缓解一下卡的情况。
考虑之后的程序用什么来做，于是又搜了一下php，发现几年真是大发展php的明明空间大量应用，匿名函数和闭包竟然都支持了，laravel的几个命令行工具，简明语义的语法写法，composer这个类似bundle的好东西，使php本身的混乱程度大幅减少。
命名空间之前还听说的时候没见哪实际用过，现在看看一些新库的代码都已经用在生产上了，php还是很有搞头。
发现了phalcom这个php框架，竟然是用c写的来大幅提升系统性能，实在是令人意外。
于是用phalcom网站的测试方法测试了一下各个框架
ab和程序都是运行在同一主机，6g内存apu4核
测试了一下各个框架的ab -n 2000 -c 10 http://xxxx
rails用的是rails4.1，新建的一个临时程序，nginx + unicorn，就简单的能跑出hello world，在production模式下
Concurrency Level: 10
Time taken for tests: 1.461 seconds
Complete requests: 2000
Failed requests: 0
Total transferred: 888000 bytes
HTML transferred: 22000 bytes
Requests per second: 1369.20 [#/sec] (mean)
Time per request: 7.304 [ms] (mean)
Time per request: 0.730 [ms] (mean, across all concurrent requests)
Transfer rate: 593.68 [Kbytes/sec] received
beego的helloworld
Concurrency Level: 10</description>
    </item>
    
    <item>
      <title>php included from debug_backtrace</title>
      <link>http://superwf.github.io/p654/</link>
      <pubDate>Wed, 25 Sep 2013 02:07:26 +0000</pubDate>
      
      <guid>http://superwf.github.io/p654/</guid>
      <description>今天改个php的模板，不知道文件是从哪里调用的。找到了这么个函数，把所有includer以数组的形式显示出来，递归查看调用信息。
很方便
http://stackoverflow.com/questions/5204830/can-an-included-php-file-know-where-it-was-included-from
  </description>
    </item>
    
    <item>
      <title>php email</title>
      <link>http://superwf.github.io/p496/</link>
      <pubDate>Sat, 08 Jun 2013 05:35:21 +0000</pubDate>
      
      <guid>http://superwf.github.io/p496/</guid>
      <description>有个用php发送邮件的玩意出了问题。
看了一下，原来的东西用的是phpmailer，用的一个163的邮箱做smtp验证发送。
出问题是因为当天发送太多了，我进了一下这个163邮箱发现直接用网页发送提示数量超额，只能第二天接着发。
于是打算把这个服务改到自己的邮件服务器上。
不过phpmailer这玩意实在不好用，无论如何不能通过验证…
于是看了一下roundcube里，用的是pear的net_smpt
于是也就跟着用了。
改了之后测试了一下，用户名密码肯定都没问题的情况下出错
relay access denied
出错几次之后还被自己的防火墙给封了….
幸亏邮件服务器也是自己的，改了一下postfix的main.cf
在 mynetworks 里把自己服务器的ip也加了进去，凑合能发了。
但是 gmail的邮箱退信不能收说是不兼容
Our system has detected that this message
is 550-5.7.1 not RFC 2822 compliant
按照这个解决了一下，在邮件头添加了一下From和To
http://webmasters.stackexchange.com/questions/43059/why-is-an-email-failing-rfc2822-specifications</description>
    </item>
    
    <item>
      <title>php支持mongodb</title>
      <link>http://superwf.github.io/p398/</link>
      <pubDate>Wed, 27 Mar 2013 08:43:06 +0000</pubDate>
      
      <guid>http://superwf.github.io/p398/</guid>
      <description>本以为php内置了mongodb的支持，或者apt就可以下载自动配置。
最后还是照mongodb网站的指示做
先aptitude install php-pear php5-dev
pecl install mongo
再创建一个文件 /etc/php5/mods-available/mongo.ini
里面写
extension=mongo.so
ln -s /etc/php5/mods-available/mongo.ini /etc/php5/conf.d/mongo.ini
最后按系统规矩做个软链接
ln -s /etc/php5/mods-available/mongo.ini /etc/php5/conf.d/mongo.ini
重启fpm</description>
    </item>
    
    <item>
      <title>nginx&#43;fastcgi(11: Resource temporarily unavailable)</title>
      <link>http://superwf.github.io/p358/</link>
      <pubDate>Mon, 10 Dec 2012 03:09:01 +0000</pubDate>
      
      <guid>http://superwf.github.io/p358/</guid>
      <description>老项目上偶尔会出现404 error
老项目配置的是php4，单独编译的，每次出现这个错误的时候日志都是
nginx+fastcgi(11: Resource temporarily unavailable)
看socket文件是没问题，php4的进程也都在，之前都是重启php4的进程就行了，但为了一劳永逸，搜了一下
发现这个
http://forum.nginx.org/read.php?3,31467,31467
先暂时改了
sysctl net.core.somaxconn=8192
nignx配置文件里
event {
worker_connections 8192;
use epoll;
}
也跟着改了，先用一阵子看还有没有404错误。</description>
    </item>
    
    <item>
      <title>php Internal Server Error</title>
      <link>http://superwf.github.io/p165/</link>
      <pubDate>Wed, 31 Aug 2011 02:27:10 +0000</pubDate>
      
      <guid>http://superwf.github.io/p165/</guid>
      <description>帮人配置个redhat上的php环境，万网已经给配置好了，但是一跑php就Internal Server Error
看了半天，说是改权限755了，没用。
看apache日志把，说是文件gid小于了允许运行的min_gid
把文件都改成apache用户所属
chown nobody:nobody /var/www/htdocs -R
搞定</description>
    </item>
    
  </channel>
</rss>