今天有运营同事反馈在使用一个内部的运营工具时,有些操作失败,后来抓包发现,post到服务端的数据是正常的,在服务端接受到的数据却并不完整,有缺失。很是奇怪。看了下nginx的error log,发现问题所在了,原来是php有设置最大接受变量个数。

2014/04/02 18:06:33 [error] 23623#0: *1115 FastCGI sent in stderr: "PHP message: PHP Warning:  Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in Unknown on line 0" while reading response header from upstream, client: 10.18.120.25,

所以,需要做的就是修改下php.ini中的设置:max_input_vars ,默认没有开启,默认值是1000,修改为自己合适的值,就可以了。


阅读全文

undefined symbol: itoa

itoa不是c的一个标准输入输出,所以可能不在stdlib.h里。

解决办法很简单,不就是要把整型转为字符串么。sprintf 格式化输出一下就好了。

举个例子:

int val = 177;
char *val_s ;
spprintf(&val_s, 0, "%d", val);

阅读全文

php配置扩展时遇到了个这个问题:PHP Warning: PHP Startup: Unable to load dynamic library ‘/home/s/apps/php-5.2.6/extensions/curl.so’ – libcurl.so.3: cannot open shared object file: No such file or directory in Unknown on line 0

google了下,都说解决办法是:

ln -s /usr/lib/libcurl.so.4 /usr/lib/libcurl.so.3

我看了下自己的lib目录,发现也没有 libcurl.so.4,然后又查没有libcurl.so.4怎么样,答案是:

ln -s /usr/lib/libcurl.so.3 /usr/lib/libcurl.so.4

啊哈哈哈哈哈哈,乐死我了。

我个人觉得是curl.so不靠谱,从别的地方搞了一个拷贝过来,ok了。


阅读全文

尝试用libmemcached的类库链接memcache的时候,报错:sasl/sasl.h: No such file or directory。

经查发现是没有安装sasl的开发库,所以需要安装下,stackoverflow上说安装一个libsasl2-dev,用yum没找到,然后使用sasl和dev关键字筛选了下,得到了一个libgsasl-devel,然后就装上试了试,就ok了。

sasl/sasl.h: No such file or directory

sasl/sasl.h: No such file or directory

install libgsasl-devel

install libgsasl-devel


阅读全文

生成一个PHP扩展.so文件,一般就是这两种方法,第一种是在php源码内configure –[with|enable]-extension_name,然后make && make install,新扩展就会生成并保存在PHP的环境中了。

不过多半会有这种情况,我们跟别人共用一台开发机,开发机已经安装了标准的php开发环境,如果我们在用这种重新编译PHP的情况,如果我们有调试php源码,或者调试扩展,很有可能会损坏原有的标准环境,所以我们就需要另一种方法,只生成一个.so文件,然后把so手动放到标准环境下,就可以不影响大局了。

这种方式呢,也很简单,跟第一种方法一样,三步搞定。

一、phpize

进入你开发php扩展的扩展根目录,比如我想做的扩展是 fkhelloworld,目录在这里 /home/s/www/fukun/clang/php-5.2.6/ext/fkhelloworld.

在这里执行phpize,如果提示找不到此命令,就找到你php的bin目录,执行全路径的命令,比如我的phpize在这里:/home/s/apps/php-5.2.6/bin/phpize

If you look in the current directory at this point, you’ll notice a lot more files than you had there a moment ago. The phpize program combined the information in your extension’s config.m4 file with data collected from your PHP build and laid out all the pieces necessary to make a compile happen. This means that you don’t have to struggle with makefiles and locating the PHP headers you’ll be compiling against. PHP has already done that job for you.

phpize会结合你的config.m4文件中描述的信息以及你的php构建相关数据,制定合并所需的部分数据,这意味着你不必再在意makefile文件和定位要编译的php文件头,PHP已经把这些都做好了。


阅读全文

作者的图片

DigDeeply

Technology Stack: PHP/Openresty/GoLang, and so on…

Web Development Engineer

Beijing China