As of today there is still no official release of a stand alone Zend Optimizer for PHP 5.3.3. This should work with most Linux distributions. Please make backups and test before using in a production environment.
In this tutorial we be using Zend Optimizer 4.1 that is bundled in the Zend Server community edition.
You can download Zend Server CE from here http://www.zend.com/en/products/server-ce/ . You would need to download Zend Server CE 5.3 32bit or 64bit extract the ZendOptimizerPlus.so file from the package.
I have made it a little bit easier and have extracted the file.
You can download from here:
32Bit http://e-nablemybiz.com/files/zend32/ZendOptimizerPlus.so
64Bit http://e-nablemybiz.com/files/zend64/ZendOptimizerPlus.so
For this tutorial we will install the ZendOptimizerPlus.so file here:
/usr/local/Zend53 copy the file to the folder.
Now update your php.ini file. Add this to the end of the ini file.
; Optimizer+ On/Off switch. When set to Off, code is not optimized.
zend_optimizerplus.enable=1
; If set to On, use the current directory as a part of the script key
zend_optimizerplus.use_cwd=1
; If enabled, the Optimizer+ checks the file timestamps and updates the cache accordingly.
zend_optimizerplus.validate_timestamps=1
; How often to check file timestamps for changes to the shared memory storage allocation. (units: seconds)
zend_optimizerplus.revalidate_freq=2
; Enables or disables file search in include_path optimization
zend_optimizerplus.revalidate_path=0
; The verbosity of the Optimizer+ log
zend_optimizerplus.log_verbosity_level=1
; The Optimizer+ shared memory storage size. The amount of memory for storing precompiled PHP code in Mbytes. (units: MBytes)
zend_optimizerplus.memory_consumption=64
; The maximum number of keys (scripts) in the Optimizer+ hash table
zend_optimizerplus.max_accelerated_files=2000
; The maximum percentage of “wasted” memory until a restart is scheduled (units: %)
zend_optimizerplus.max_wasted_percentage=5
; Check the cache checksum each N requests
zend_optimizerplus.consistency_checks=0
; How long to wait (in seconds) for a scheduled restart to begin if the cache is not being accessed (units: seconds)
zend_optimizerplus.force_restart_timeout=180
; The location of the Optimizer+ blacklist file
zend_optimizerplus.blacklist_filename=
; If enabled, a fast shutdown sequence is used for the accelerated code
zend_optimizerplus.fast_shutdown=0
; A bitmask, where each bit enables or disables the appropriate Optimizer+ passes
zend_optimizerplus.optimization_level=0xfffffbbf
; Enables or disables the optimization passes that may take significant time, based on an internal runtime calculation
zend_optimizerplus.enable_slow_optimizations=1
Restart Apache, and Zend Optimizer is now installed:
Here is a solution to adding Google Analytics tracking code across multiple sites without having to edit any pages using mod_layout. Google Analytics uses a java-script code that must be placed on the bottom of each displayed web page.
You’ll need root access, Apache and some technical expertise install mod_layout.
Let’s get started!
mod_layout is an Apache module that provides both a Footer and Header directive to automatically include output at the beginning and ending of a web page.
You can download mod_layout from here:
http://tangent.org/index.pl?node_id=362
We’ll download the Apache 2.2 version and extract the tarbar on the server.
Install mod_layout using:
make
make install
mod_layout will install the link to the library in your http.conf as such:
LoadModule layout_module /usr/lib/apache/mod_layout.so
Restart Apache server.
Adding the GAC
Now go the web site’s document root where the web site’s web pages are and create a text file called gac.txt. You could really name it anything you want but for our purposes will use gac.txt (google analytics code).
In the gac.txt file, cut and paste your Google Analytics code from Google’s site. Your file should look like this:
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-123456-8");
pageTracker._trackPageview();
} catch(err) {}</script>Update the Virtualhost
Now we need to add the following to your <Virtualhost>..</VirtualHost>:
AddOutputFilterByType LAYOUT text/html
LayoutFooter /gac.txt
Depending on your Apache setup the <Virtualhost>..</VirtualHost> could be just about anywhere, for us, we use DirectAdmin. DirectAdmin makes this very easy. Just click on the Custom HTTPD Configuration link, select the Domain and add the above code and save.
Restart Apache
Now every displayed web page will have the Google Analytics code placed in it, view the web page source code to verify. How this works is that mod_lay is adding the text from the gac.txt file to the web page when it is displayed. The LayoutFooter directive places the added text right before the </body> tag of the web page to be displayed.
You may not want to add the footer to certain type of files, like .cgi, .pl, .rss etc., like so:
LayoutIgnoreURI *.cgi
LayoutIgnoreURI *.pl
LayoutIgnoreURI *.xml
AddOutputFilterByType LAYOUT text/html
LayoutFooter /gac.txt
Now you can easily add Google Analytics to many accounts having thousands of pages in minutes!