I need to run from the command line (PHP CLI) some files that were encrypted by Zend Guard and php just seems to quit as soon as it reaches an encoded file without any error message. Is it possible to execute PHP scripts that are encoded by Zend Guard from the command line?
More details
In the application I'm currently working on, some tasks needs to be run periodically. At first, we implemented controllers for some urls that where used only to run the tasks. Then we would do a cron job using wget
on those pages. The problem is that some of those tasks needed parameters to run. Using wget
to do a POST request does not work since the first thing that Zend Guard does is assign a cookie and then do a redirect to the same URL. On the second request, since it's now in GET, all the parameters were lost.
We then decided to move to a command line script to correct the problem. We really like this approach since it solves issues we've had with the URL-based one. First, it does not keep an open Apache connection for an extended period of time. Also, it does not expose some internal logic on public URLs. As I stated earlier, when we try to execute these command line scripts, nothing happens, the application simply quits.
We are using Ubuntu 12.04 LTS, PHP 5.4.25 and Apache 2.2.22. I made sure that the Zend Guard extension was correctly loaded in the command line. Also, it works correctly when the pages are accessed by a web browser.
If anyone can help me with this problem, it would be much appreciated. Thank you!
I'm going to make an assumption here. When you guys moved the script to run from command line, you didn't actually re-write the script. You simply just do php -f on the file instead of wget on the URL.
If that's the case, you probably have some logic in the script that requires authentication or web server logic with an exit/die if the param isn't found. You mentioned that some scripts need POST to run, so my guess would be there's a $_POST in there somewhere which obviously won't work on the command line.
Just a guess though.
EDIT: Just read the part where you said it works when you access through URL. Almost definitely a $_POST or something similar.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With