This article is also available in our new Knowledge Base: "Z-Ray Live!" Does Not Work with PHP CLI
GNU / Linux
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!
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:
3. If you are working as a non-root user, run the script in CLI using sudo, for example:
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):
Note: we recommend using sudo instead of setting world writable permissions to /usr/local/zend/var/db.