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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
PaulMM
Forum Newbie
Posts: 15
Joined: Wed Oct 01, 2008 8:21 am

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

Post 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?
User avatar
Ziq
Forum Contributor
Posts: 194
Joined: Mon Aug 25, 2008 12:43 am
Location: Russia, Voronezh

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

Post 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();
?>
 
PaulMM
Forum Newbie
Posts: 15
Joined: Wed Oct 01, 2008 8:21 am

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

Post by PaulMM »

Cool, thanks go to Russia! Спасибо друг :)
User avatar
Ziq
Forum Contributor
Posts: 194
Joined: Mon Aug 25, 2008 12:43 am
Location: Russia, Voronezh

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

Post by Ziq »

:)
PaulMM
Forum Newbie
Posts: 15
Joined: Wed Oct 01, 2008 8:21 am

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

Post 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?
Post Reply