Fatal error: Class 'Zend\Loader\AutoloaderFact

2019-08-09 22:02发布

I had successfully tested my ZF2 application on my test server. When I published the application to the live server I got the following error:

Unable to load ZF2. Run `php composer.phar install` or define a ZF2_PATH environment variable.

This error disappeared after adding this line to my index.php.

putenv("ZF2_PATH=/opt/zf2/library/");

But now I get the AutoloaderFactory-not-found error instead, which means PHP still doesn't find the classes. The live server is a 1und1 (1and1, 1&1) managed server.

uname -a yields Linux infongd8707 2.6.28.8-20120713a-iscsi-ntacker-3ware-sec8-fmon-igb-dif2-grsec #1 SMP Fri Jul 13 13:37:07 CEST 2012 i686 GNU/Linux

The workaround as described in the ZF2 installation instructions doesn't help.

  • I'm not allowed to set an environment path in the httpd.conf.
  • SetEnv statements in the .htaccess seem to be ignored by Apache's configuration.
  • Setting ZF2_PATH with putenv does help just a bit as described above.
  • Including the library path with set_include_path, tried both absolutely and relatively, doesn't help, although phpinfo() shows that it's set as local value.

Anybody experienced the same?

1条回答
Root(大扎)
2楼-- · 2019-08-09 22:34

The solution is rather interesting for 1&1 customers. It seems as if on their managed servers unzip, which I used to extract my project, is an alias for unzip -L which forces all extracted files to be lowercase. Since our test server and the live server both are case-sensitive regarding files and directories, this behaviour made lots of directories inaccessible.

查看更多
登录 后发表回答