Archive for May, 2009

How to Install Zend Optimizer/Encoder on cPanel/WHM

Zend Optimiser is a PHP addon which offers caching to improve speed when loading sites, it can increase perfomance by up to 40% by caching frequently viewed portions of PHP pages. Zend Encoder also is useful for
encoding PHP files to protect source code.

To install Zend Optimizer:

1. Login to your server via SSH

2. Run:

/scripts/installzendopt

3. Follow the instructions on the screen to install Zend Optimizer

For those who are installing Zend Optimizer for performance gains you may want to take a look at Turck MMCache, providing speed increases of up 90% it has amazing caching and optimization capabilities. It can also run
along side Zend Optimizer.

SBDavid

How to install Eaccelerator

How to install Eaccelerator

eAccelerator is a free open-source PHP accelerator, optimizer, and dynamic content cache. It increases the performance of PHP scripts by caching them in their compiled state, so that the overhead of compiling is almost completely eliminated. It also optimizes scripts to speed up their execution. eAccelerator typically reduces server load and increases the speed of your PHP code by 1-10 times.
1.
Download Eaccelerator

wget http://bart.eaccelerator.net/source/0.9.5.3/eaccelerator-0.9.5.3.tar.bz2

2. Extract and move into the directory.
3. Locate where php is

locate php

4. Create configuration files

phpize

5. Compile Eaccelerator

./configure –enable-eaccelerator=shared –with-php-config=/usr/local/bin/php-config
make
make install

To install as Zend extension:

zend_extension=”/usr/lib/php4/eaccelerator.so”
eaccelerator.shm_size=”16″
eaccelerator.cache_dir=”/tmp/eaccelerator”
eaccelerator.enable=”1″
eaccelerator.optimizer=”1″
eaccelerator.check_mtime=”1″
eaccelerator.debug=”0″
eaccelerator.filter=”"
eaccelerator.shm_max=”0″
eaccelerator.shm_ttl=”0″
eaccelerator.shm_prune_period=”0″
eaccelerator.shm_only=”0″
eaccelerator.compress=”1″
eaccelerator.compress_level=”9″

If you use a thread safe build of PHP you must use “zend_extension_ts” instead of “zend_extension”.

To install as PHP extension:

extension=”eaccelerator.so”
eaccelerator.shm_size=”16″
eaccelerator.cache_dir=”/tmp/eaccelerator”
eaccelerator.enable=”1″
eaccelerator.optimizer=”1″
eaccelerator.check_mtime=”1″
eaccelerator.debug=”0″
eaccelerator.filter=”"
eaccelerator.shm_max=”0″
eaccelerator.shm_ttl=”0″
eaccelerator.shm_prune_period=”0″
eaccelerator.shm_only=”0″
eaccelerator.compress=”1″
eaccelerator.compress_level=”9″

SBDavid

Using Netstat

To find out the largest number of established connections you can simply use something like

netstat -an | grep ‘ESTABLISHED’ | awk ‘{print $4}’ | cut -d: -f1 | uniq -c | sort -rn | head -n 1

To see the list of the top 10

netstat -an | grep ‘ESTABLISHED’ | awk ‘{print $4}’ | cut -d: -f1 | uniq -c | sort -rn | head -n 10

To view all

netstat -an | grep ‘ESTABLISHED’ | awk ‘{print $4}’ | cut -d: -f1 | uniq -c | sort -rn
SBDavid

FrontPage problems on cPanel/WHM

FrontPage problems on cPanel/WHM

FrontPage problems can be addressed by:

1. Running

/scripts/initsuexec

2. Uninstalling and reinstalling the FrontPage extensions on the affected account

3. Checking for errors generated by visiting the FrontPage administration interface at

http://domain.com/_vti_bin/_vti_adm/fpadmcgi.exe
SBDavid

Ruby on Rails and cPanel/WHM

Ruby on Rails and cPanel/WHM

The installation of Ruby on Rails in cPanel has two parts, first is installing Ruby itself, which can be accomplished by running

/scripts/installruby

This script will install Ruby, RubyGems, Mongrel and the software that Ruby relies upon and activates the Ruby interface in your end user’s cPanel.

The second step in the installation is running.

/usr/local/cpanel/bin/ror_setup

This script will setup Ruby on Rails so that it will be activated when your system starts.
Ruby runs a separate server other than Apache for serving Ruby on Rails web applications, so setup for this requires a little more work. First you will need to login to your cPanel and click on the Ruby on Rails icon, to bring up the Ruby on Rails management interface that allows you to setup your Ruby environments. At this point, you will need to give your application a name and setup its path.

Note: If you set this path inside of your public_html directory your application’s source code and configuration files can be viewable by anyone on the web.

If you pay close attention to the URL used for the application, you will see that it has a number like :12001 at the end of it. This is because Ruby on Rails does not use the standard Apache web server, but rather uses its own, called Mongrel.

We can change these to be user-friendly. You will need to create a new subdomain or addon domain in cPanel, then click on the create rewrite button next to the Rails application name in cPanel, select the desired domain name from the drop down box, and now, whenever you go to this domain, it will display the RoR application

You will need to ensure
that ports 12001 and up are open (we recommend making the max number of the open ports 12001 plus whatever the number of Ruby applications you expect to be running will be).

Sometimes the gems repos will go down. If this happens during the installation, you will need to re-run /scripts/installruby.

« Prev - Next »