Zend Guard and iFrames don't play together

General discussion on Zend Guard / Optimizer
Post Reply
Posts: 2
Joined: Mon Nov 19, 2012 6:48 pm

Zend Guard and iFrames don't play together

Post by gskat » Wed Nov 21, 2012 4:04 pm

It seems that the programmers at Zend don't believe in iFrames. When we encode our working application, any pages generated into iFrames produce the old not configured message: "Zend Guard Run-time support missing!
One more more files on this web site were encoded by ZendGuard and the required run-time support is not installed orproperly configured." This message is generated into the iFrame of the encoded application that is otherwise running normally. When you view the sources, the generated the meta data for the parent window is exactly the same as the meta data for the window in the iFrame(In an un-encoded version running under straight Apache and PHP). We are testing with Zend Server and have come up with an eerily similar problem with iFrames content not being able to see the parent window's javascript environment (see "Permission denied to access property,iframe javascript error" in the Zend Server CE forum 11-19-12). These tests have all been performed with Zend Server CE, as it appears that it is not practical to try to run Zend Loader or Optimizer with any of the Windows AMP stacks due to threading, version constraints, and now it looks like we will not be moving to the Zend platform any time soon. This application is producing HTML 4.01 Transitional code and has no issues with HTML validation.

User avatar
Zend Global Support
Posts: 994
Joined: Sun Dec 14, 2008 9:48 am

Re: Zend Guard and iFrames don't play together

Post by zvika » Tue Nov 27, 2012 9:35 am


I wish to start with a short explanation on how Zend Guard operates, or should work.
Zend Guard encodes PHP scripts, once you complete development and test the code for errors.
Next, Zend Guard Loader decodes these scripts at runtime and serve them to the PHP engine.
This process requires the Zend Loader to be enabled in Zend Server, or any other PHP compatible with loading Zend Guard Loader.

You reported an error: "Zend Guard Run-time support missing!".
This, for starters, requires you to check if you get Zend Loader component in phpinfo() output, and if not, enable it (Easier to do on Zend Server since it is an optional component, unlike other PHP setup where you need to manually install from standalone package).

Next, iFrames loads HTTP/S responses jsut as the main Window does, so it doesn't make any difference for Guard Loader or PHP if you request the PHP script from iFrame or any other HTTP client / window.

To troubleshoot, You need to look in the Access log to identify the request that the iFrame made, or simply run the same request from Browser / WGET if you know it already.
Then, check Apache/PHP error log to see what comes up to give you a hint about the problem.

If there is an error, or crash - it needs to be fixed in the level of PHP / Guard Loader.
If there is no error, but the output from open source PHP script(s) is not the same as encoded PHP script(s), it needs to be further checked to identify what is the difference and how to fix it, for example, obfuscated Classes/Functions which are called by name on runtime, needs to be excluded from obfuscation in Guard Encoding time, or inserted to a special runtime obfuscate API to convert their names on runtime (see the Guard online reference for available API methods).

Last thing - if there is no error, Guard Loader is loaded and serving encoded PHP scripts, and output from encoded and open source scripts is the same,
the problem might be in the HTML/Javascript code.

Hope this helps.

P.S. - You were partially correct in your first sentence, I personally am not a believer of iFrames since AJAX and CSS came into modern web browsers.
In pre-(historical)-AJAX era, I heavily utilized iFrames to load dynamic content to floating DIVs and behave like today's applications not loading the main window.
Zvika Dror
Zend Support Team

Post Reply