Page 1 of 1

How to check if Zend Optimizer is installed at the server?

Posted: Sun Oct 05, 2008 12:16 pm
by PaulMM
I need to write a script which will show my users what software they need to install at their server in order to run my scripts well. I have written everything, but now I'm thinking on how to show them my own message whether they need Zend Optimizer Installed or not. Is there any server variable I can check? thanks.

P.S. The method Zend has with headers precompiled into encoded php scripts - does not work for me, because I need to show my own message concerning Zend presence. How can I check if ZendOptimized is there or not?

Re: How to check if Zend Optimizer is installed at the server?

Posted: Sun Oct 05, 2008 12:36 pm
by Ziq
If Zend Optimizer install on server you can use zend_optimizer_version() function. But if it don't install, call function zend_optimizer_version() returning fatal error. You should combine two function to check this:

Code: Select all

 
<?
if(!function_exists('zend_optimizer_version')) echo 'Install Zend Optimizer';
else echo 'Zend Optimizer version: '.zend_optimizer_version();
?>
 

Re: How to check if Zend Optimizer is installed at the server?

Posted: Sun Oct 05, 2008 2:17 pm
by PaulMM
Cool, thanks go to Russia! Спасибо друг :)

Re: How to check if Zend Optimizer is installed at the server?

Posted: Sun Oct 05, 2008 2:50 pm
by Ziq
:)

Re: How to check if Zend Optimizer is installed at the server?

Posted: Sun Oct 05, 2008 4:24 pm
by PaulMM
One more question. My script includes one of Zend Encoded php files using standard include function like that:
include('some_zend_encoded_file.php');
Everything works fine but it is well known that Zend Encoded files must be uploaded via FTP in Binary Mode. Nevertheless, some customers upload files in Text mode by mistake and php files become non-working. And an error usually appears:

Fatal error: Unable to read 27003 bytes in /home/user/domains/mydomain.com/public_html/some_zend_encoded_file.php on line 0

Is there any way which allows us to check if the uploaded Zend file was uploaded in Binary mode? It will be great as I would have an opportunity to show my own warning "please upload the file in Binary mode" before doing the include.
I had an idea of checking a function like that:

Code: Select all

 
@include('some_zend_encoded_file.php');
if (!function_exists('a_function_in_zend_encoded_file')) {
   echo 'file was not uploaded in Binary mode!';
}
 
but this doesn't work as my script dies after doing the include('some_zend_encoded_file.php'); with Fatal Error. Any ideas?