zend-patterns / ZendServerSDK

Pure ZF2 CLI for zpk creation and webapi client.
BSD 3-Clause "New" or "Revised" License
22 stars 17 forks source link

RuntimeException on launch #51

Closed ze42 closed 9 years ago

ze42 commented 9 years ago

I have a host (note for self: host328) on which we get a RuntimeException when trying to launch the script. It just fails to load and do anything useful.

# php /usr/local/lib/xxx/zendserver/zs-client.phar command:help

Fatal error: Uncaught exception 'Zend\Stdlib\Exception\RuntimeException' with message 'glob('config/autoload/{,*.}{global,local}.php', 1024) failed' in phar:///usr/local/lib/xxx/zendserver/zs-client.phar/vendor/zendframework/zend-stdlib/Zend/Stdlib/Glob.php:2
Stack trace:
#0 phar:///usr/local/lib/xxx/zendserver/zs-client.phar/vendor/zendframework/zend-stdlib/Zend/Stdlib/Glob.php(2): Zend\Stdlib\Glob::systemGlob('config/autoload...', 16)
#1 phar:///usr/local/lib/xxx/zendserver/zs-client.phar/vendor/zendframework/zend-modulemanager/Zend/ModuleManager/Listener/ConfigListener.php(2): Zend\Stdlib\Glob::glob('config/autoload...', 16)
#2 phar:///usr/local/lib/xxx/zendserver/zs-client.phar/vendor/zendframework/zend-modulemanager/Zend/ModuleManager/Listener/ConfigListener.php(2): Zend\ModuleManager\Listener\ConfigListener->addConfigByPath('config/autoload...', 'glob_path')
#3 [internal function]: Zend\ModuleManager\Listener\ConfigListener->onLoadModulesPost(Object(Zend\ModuleManager\ModuleEvent))
#4 phar:///usr/local/lib/xxx/zends in phar:///usr/local/lib/xxx/zendserver/zs-client.phar/vendor/zendframework/zend-stdlib/Zend/Stdlib/Glob.php on line 2

Any idea what could cause such error, or how to investigate further?

clarkphp commented 9 years ago

Hello ze42, I will need help reproducing your problem. I just performed the following, and did not experience the error you reported (I'm running Zend Server, hence the symlink to php binary):

sudo ln -s /usr/local/zend/bin/php /usr/local/bin/php
php -r "readfile('https://github.com/zendtech/ZendServerSDK/raw/master/bin/zs-client.phar');" > zs-client.phar
php ./zs-client.phar

I also do not experience the error when running the default version of ZendServerSDK installed on Zend Server:

php /usr/local/zend/var/libraries/ZendServerSDK/default/library/zs-client.phar

Where did the phar in your directory /usr/local/lib/xxx/zendserver/ come from? You seem to be running Zend Server: which version?

Regards, Clark

ze42 commented 9 years ago

I do have servers on which it does work, no doubt about that.

Also using zend's php:

lrwxrwxrwx 1 root root 23 Sep 30 11:37 /etc/alternatives/php -> /usr/local/zend/bin/php
lrwxrwxrwx 1 root root 21 Sep 30 11:37 /usr/bin/php -> /etc/alternatives/php

zs-client.phar was latest from master branch on this repository. (sha1:3e5a631b37c2850514c7a1fb30766291169f66cf).

Zend Server version: zend-server-php-5.4 6.2.0+b2004 (from .deb package provided by Zend)

And, I do not have a /usr/local/zend/var/libraries/ZendServerSDK directory (even on some 7.0.0+b469 I have around). Is that now an official part of Zend Server?

clarkphp commented 9 years ago

Hi ze42, Interesting that it works fine on the rest of your servers, but not on this one. Something must be different somehow, even if all of your servers are running the same version of Zend Server and zs-client.phar. The glob call failing implies something wrong locating or loading the internal configuration (which you can look at in the repo under config/autoload directory).

I must be looking at the repo wrong; I find no commit matching the hash you cited

The VM I'm using is running Zend Server version 8.0.1 (8.0 with the latest PHP Security fix applied, will be GA in January), Ubuntu 14.04. I'll have to check versions 7.0, 6.3, 6.2, etc. to see how library paths changed (and when we introduced libraries, in addition to applications - version 6.2 has been a while ago).

Anyway, I should have pointed you to the /usr/local/zend/bin/zs-client.sh script, which invokes the phar file, instead of the phar itself, since as the phar is updated, the shell script will point to the newer versions. If you don't have /usr/local/zend/bin/zs-client.sh, then we started bundling zs-client tool after your version of Zend Server.

/usr/local/zend/var/applications are where application deployment packages are deployed, and /usr/local/zend/var/libraries are where library deployment packages are deployed.

Try this, and see if you experience the same trouble (below, you can use either zendtech or zend-patterns in the URL, doesn't matter):

cd /to/a/directory/of/your/choice
php -r "readfile('https://github.com/zend-patterns/ZendServerSDK/raw/master/bin/zs-client.phar');" > zs-client.phar
php ./zs-client.phar

You should see the regular help text appear. That's the latest phar. In the meantime, I'll look for any reported issues regarding glob.

slaff commented 9 years ago

If there is more detailed information we can reopen this issue.