Session save path should be writable

由于我系统里的 php session save path 是由当初 apache 创建的,改用 nginx 后就变成不可写了。但是,症状并不直观,php 照样能运行,phpMyAdmin 也能 login,还能查看各库各表的数据,但就是不能更新、删除,也无法 logout。无法 logout phpMyAdmin 的具体症状也不是其他人描述的那样(logout 时提示输入用户名和密码),就是点了没效果,仍在管理界面(还有人说启用 http basic auth login 的话就是无法 logout 的,只能关闭浏览器才 logout,这纯属无稽之谈)。 我一直认为是 phpMyAdmin 或 mysql 设置出问题的,根本没往 php session save path 是否可写这方面想,我想当然地以为如果 php session save path 不可写,在 php 里启用 session 就会出错,别想进入 phpMyAdmin。

Zend_Db ignore default charset of Mysql

While I set my Mysql database default character set as UTF-8, Zend_Db_Adapter does not pick up the setting. Zend_Db write to Mysql using its own default character set (I guess it’s ISO-8859-1), unless it is specifically told by $dbAdapter->query(“SET NAMES ‘utf8′”); before Zend_Db_Table::setDefaultAdapter($dbAdapter);

Run Magento on GAE

Google App Engine 不久前开始支持第二种语言 Java,我当时听到这个消息马上开始期盼什么时候 GAE 支持 PHP。 今天看到 Quercus 项目,它可以让 PHP 运行在 Java 环境,我才意识到不用再期盼在 GAE 跑 PHP 程序,这已成为现实。这下我有事情做了——怎么把 Magento 跑在 GAE 上?

DtDdWrapper in Zend Framework

我尝试着用 Zend Framework 重写了一个程序。在 Zend_Form 上徘徊了好久,研读了 Programmer’s Reference Guide N 遍,还是没有融会贯通。比如说,我想去掉默认的DtDdWrapper,用 $element->removeDecorator(‘DtDdWrapper’); 只对某些element起作用,对 Zend_Form_Element_Text 怎么也不起作用,最后发现用 $element->removeDecorator(‘HtmlTag’); 倒可行。 问题是解决了,但还是没摸清 Zend Framework 设计思路。很累。 续: 其实,用$element->removeDecorator(‘HtmlTag’); 问题并没有完全解决。后来我用 var_dump($element->getDecorators()); 查看了默认加载的装饰器以及装饰器的参数,发现对于 Zend_Form_Element_Text 来说,它的 dt 和 dd 并不是由 DtDdWrapper 加载的,事实上 Zend_Form_Element_Text 默认不加载 DtDdWrapper,难怪 $element->removeDecorator(‘DtDdWrapper’); 是不起作用的。 那么,Zend_Form_Element_Text 的 dt 和 dd 是哪里来的呢?我仔细看了 var_dump 的结果,发现 dt 是由默认的 Label 装饰器默认的 dt 参数带来的 dd 是由默认的… Continue reading DtDdWrapper in Zend Framework

Published
Categorized as 小小草 Tagged

Zend Framework lack of datagrid component

Zend Framework is evolving quickly. Some while ago, it did not have Zend_Paginator, but now it’s there. But a component of paginator is enough for me. I want something like Zend_Datagrid. It’s not there yet. pao.fresco has developed Datagrid for Zend Framework. It looks good, but I am not confident using unofficial code. Magento also… Continue reading Zend Framework lack of datagrid component

nginx has no path_info

ngnix 0.6.35 没有实现 path_info。不知道 nginx 开发者是疏忽了,还是觉得没必要在 http server 层实现 path_info。我印象中有很多 php 程序的运行都依赖 $_SERVER[‘PATH_INFO’],所以在 ngnix proxy pass 给 php-cgi 之前,必须设置好正确的 path_info 参数。 我认为最好的办法还是用正则表达式在 $fastcgi_script_name 里隔离出 script_name 和 path_info,但这样计算出的 path_info 用起来不如 ngnix variable 方便,而且得在脚本的安装位置或扩展名确定时才能写出相应的正则表达式。我是 nginx 新手,在 path_info 上折腾了三天才总结出一个相对满意的方案。如果 nginx 能给我一个 in-built variable $path_info,那会省事很多。 当然我并不想责怪 nginx(apache 已经够令人称赞了,nginx 能超越它实属不易),说不定 nginx 不搞 path_info 有它的道理。 既然这样,php 编程时就应该考虑到 path_info 是不可靠的。以前我不太注意环境参数的获得性,如今审视了一下,除了 $_SERVER[‘PATH_INFO’]以外,$_SERVER[’PHP_SELF’] 和… Continue reading nginx has no path_info

I can’t find a way to assign two handlers to a script

这可能是一个不可能实现的任务。 Actinic 的动态部分是 perl 写的,我不想触及 perl,陆陆续续做了很多 extensions,都是 php 写的。Actinic perl 有很多漏洞,其中一个就是会把我的 php 源码暴露。可能 Actinic 的目标用户都是 htmler,根本没指望 phper 会给它写 extensions(我也是没办法,早就不想干了)。我能做的,就是尽可能地调整 php 的代码方式,做到即使源码暴露了,也不包含机要信息。 我也不打算在 Actinic 浪费时间去研究怎么修改漏洞,只是最近把 apache module 研究了一遍,突然想重提这个历史遗留问题是否可以从 apache 方面给予弥补。漏洞的源头是 Actinic perl 读入我的 php script,当成 html 直接输出。如果能把 handler 再交给 php-cgi,那么 php tag 之间的内容就可以得到解析。 可是 apache 是以后缀推定 handler 的,那么某个后缀怎么可以有两个 cgi handlers?