Inconsistent results with PHP Reflection API

2019-08-01 16:15发布

I have an application that works perfectly on both Windows & Mac that uses the PHP5 Reflection API.

I attempted to deploy the application to a Linux machine (CentOS box running PHP 5.3.6 -production server), only to find that the ReflectionMethod::getDocComment() function does not return anything. I investigated for a little while, and discovered that the line-endings were a potential culprit.

I used the dos2unix utility on my server to change the line-endings all to Unix-style, and the script works. Now here's the strange part: it only works once. By this, I mean that the script which returns the data from ReflectionMethod::getDocComment() works once, and then (without any modification to the files on disk or the code) it reverts back to not working.

Any help or advice would be greatly appreciated.

1条回答
Fickle 薄情
2楼-- · 2019-08-01 16:26

Instead of turning it out globally you may use php_flag in your .htaccess like so :

php_flag eaccelerator.enable 0
php_flag eaccelerator.optimizer 0

I had the same issue and it took me some time to figuring out (3 hours) because I didn't own the production server.

查看更多
登录 后发表回答