"Z-Ray Live!" Does Not Work with PHP CLI

Follow

Applies To

Zend Server

GNU / Linux 

 

Issue

When you execute a PHP script via the CLI, Z-Ray Live! does not display the Z-Ray data in the Zend Server UI | Z-Ray | Z-Ray Live!

 

Solution

The following procedure will guide you through the troubleshooting process for this issue and enable Z-Ray Live! to correctly capture the Z-Ray data.

1. Obviously, Z-Ray must be enabled and configured to run in CLI mode on your system. Navigate to the Zend Server UI | Z-Ray | Settings | Advanced and make sure that Enable in CLI Mode is set to Yes.

 

2. Verify that you're using Zend Server's PHP binary /usr/local/zend/bin/php (or /usr/local/zend/bin/php-cli) to run the PHP script via the CLI. To be sure, you can input the full path to the PHP binary when you run the script, as demonstrated below:

# /usr/local/zend/bin/php script.php

 

3. If you are working as a non-root user, run the script in CLI using sudo, for example:

$ sudo /usr/local/zend/bin/php script.php

If this works (i.e. you see the execution data in Z-Ray Live!), you can simply change the ownership of the files involved in the process (in order to be able to run scripts without sudo):

$ sudo chmod 777 /usr/local/zend/var/db /usr/local/zend/var/db/devbar.db

Note: we recommend using sudo instead of setting world writable permissions to /usr/local/zend/var/db.

Have more questions? Submit a request

Comments

Powered by Zendesk