Set up Zend Server and Magento on Centos 6

Finally got a chance to write up a quick guide on how to set up Magento running on Zend Server Community on Centos 6.

Server Hosting

I have been wondering around between Rackspace and Ninefold. My website is gonna be for Australian market only. Ninefold is clearly faster choice, but more expensive, especially when I don’t know whether my website can make money or not. I have been using Rackspace for a while and really enjoy their service. The only thing I am worry about is the SEO impact if I host an Australian website on U.S. After days of researching, I decided to give Rackspace a go, and I think if the website goes well, I may just move the website back to Australia eventually.

Install Zend Server

In here, I have to mention on Magento site, there is a bundle install script for Zend + Magento, however, I tried that and the script doesn’t work anymore. They should have updated that script more frequently. Anyway, let us do our own.

Change SELinux setting

setenforce permissive

Add Yum repos for Zend

vim /etc/yum.repos.d/zend.repo

Paste the content below into zend.repo

name=Zend Server

name=Zend Server - noarch

Install Zend Community Edition with PHP 5.3

yum install zend-server-ce-php-5.3


Normally I just simply open ports for: Zend Server, HTTP, HTTPS, FTP, SSH.
iptables -I INPUT 5 -p tcp --dport 10081 -j ACCEPT
iptables -I INPUT 5 -p tcp --dport 443 -j ACCEPT
iptables -I INPUT 5 -p tcp --dport 80 -j ACCEPT
iptables -I INPUT 5 -p tcp --dport 21 -j ACCEPT
iptables -I INPUT 5 -p tcp --dport 22 -j ACCEPT
iptables -L --line-numbers
/etc/init.d/iptables save
/etc/init.d/iptables restart


Browsing http://[server url or IP address]:10081 to set up Zend Server.


To restart Zend Server:

/etc/init.d/zend-server restart

To add Zend Server to server start up:

chkconfig zend-server on

Install MYSQL server and PhpMyAdmin

Install MYSQL client and server:

yum install mysql mysql-server

Start MYSQL server & Initialisation

/etc/init.d/mysqld start


Add MYSQL to server start up service

chkconfig mysqld on

Install PhpMyAdmin

rpm -Uvh

yum install phpmyadmin

Add your IP to allow list in phpMyAdmin apache conf file:

vim /etc/httpd/conf.d/phpMyAdmin.conf

/etc/init.d/zend-server restart

Install Magento

Download Magento Sample data

Use phpMyAdmin to create Magento database and import the sample database dump.

tar -zxvf magento-sample-data-

Move sample media files to web folder (I use /var/www/html as document root folder here):

mv magento-sample-data- /var/www/html/

Download Magento


tar -zxvf magento-

cp -r magento/* /var/www/html/

cp magento/.htaccess /var/www/html/

change folder permission

chmod -R o+w media var

chmod o+w app/etc

Set up FTP

I will need a FTP account to deploy my Magento skins to server. Proftpd is clearly a better choice.

yum install proftpd

service proftpd start

chkconfig proftpd on

useradd magento
 passwd magento

Need to change user's default login place:

vim /etc/passwd 

Give user written permission to Magento folder:

chown magento.magento /var/www/html/ -Rf 

Enable Web URL Rewrite to support SEO

vim /etc/httpd/conf/httpd.conf

Change AllowOverride All for your document folder, restart Zend Server.

Now proceed with Magento GUI installation by browsing: http://[server url]



I found folder permission is not enough for Magento Connect to use, on the other side, I need to make sure FTP user has permission to upload source files. Here is the steps I found works well without setting folder permission to 777.

#add apache to FTP user group: magento
#your magento folder should have magento.magento ownership
#while you are in magento folder, do following:
sudo usermod -G magento apache
sudo find . -type f -exec chmod 644 {} \;
sudo find . -type d -exec chmod 775 {} \;
sudo chmod o+w var var/.htaccess app/etc
sudo chmod 550 lib/PEAR
sudo chmod -R o+w media
sudo /etc/init.d/httpd restart

How to fix Cisco ASA 5505 uploading speed very slow problem

Today I had a chance to play with ASA 5505, to connect to 50M fabric link for a client.

The 50M link ISP provides me the Static IP, Network Mask, Gateway and DNS details.

Set up connection

Edit ‘outside’ interface and choose static IP:

Change Static Route:

Save and reload, and you should be connected to 50M link now.

Speed Test

I connected my laptop wired to Cisco ASA 5505, and do a speed test on (I know it is not accurate, but just give a rough idea what you got).

Download speed: around 50M – good!

Upload speed: around 1M – what?!


Change ‘outside’ ethernet port to have “Full Duplex” and “100M” speed. Save and reload. Tested again: Upload speed: around 50M – nice.


I don’t have much experience with Cisco, and this is just my personal experience to share. Please correct me if I made any mistakes.


While I got it working full speed, I still have other issues listed below. If anyone can assist me, it will be much appreciated.

  1. Connect a Wireless router to this Cisco ASA 5505. When my laptop connected with wireless, I can’t do uploads. (browsing Internet is fine). I can’t ftp a file to server and it will say “Connection reset by peer.” returns me an error when doing uploading test. However, downloading is still very fast.
    Log in Cisco is “Teardown TCP connection 2295 for outside: …… to inside ….. TCP Reset-I”
  2. VPN – I don’t see how or if it is possible for me to set up PPTP VPN on this Cisco ASA 5505 box. All I can find is WebVPN and L2TP, which doesn’t seems to be quite compatible with Windows systems.


My Favorite Centos Installation

I have installed many Linux systems, from Fedora, and now fall in love with Centos.

The best thing is you can install a lot of popular software just via YUM.

Here I just want to share that RPMForge is almost a must Repos you should add into your YUM.

It gives you a lot of useful packages that doesn’t come with default, such as phpmyadmin.

For how to install RPMForge, just follow this page.

On the other hand, if you would need latest version on PHP53, MYSQL etc, you should consider IUS Community.

It is proudly supported by RackSpace and comes with a lot of latest version packages.

For how to get started with IUS, just follow their Client User Guide.

Another tips to install latest version of PHP from IUS is to install php53u instead of php.

Server Time Issue

In Australia, we have day light saving in summer, which confuses a lot of my servers’ timing. To make it easier, just set up the NTP service and configure the right timezone.


  1. make a backup: mv /etc/localtime /etc/localtime.bak
  2. cp /usr/share/zoneinfo/Australia/Sydney /etc/localtime

Set up NTP:

  1. yum install ntp
  2. chkconfig ntpd on
  3. ntpdate
  4. /etc/init.d/ntpd start

Please note that if you are doing the time setting on virtual system, like XenServer, you should change time on host because normally the guest system’s default time setting is locked with host.

NetGear DGN2000 needs work with NetGear Filter

Hi All,

Just a quick tip to share that I had problem with NetGear DGN2000 with clients. After checking with TPG, NetGear support, we thought the box was faulty.

We replaced a new one – same issue: Can’t connect to Internet (Initialize LCP…). The telephone line is recognized but just can’t connect to Internet.

It turns out we need to use NetGear filter, and we were using DLink filter. Well, hope this helps.

Install PHPMyAdmin on Centos 5.5 64bit

Just set up a server (VPS) for customer and realized that PhpMyAdmin is not available in Yum any more?

Apparently we need to follow steps below to be able to install PhpMyAdmin via Yum.

rpm --import
cd /tmp
rpm -ivh rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm

The current version of rpmforge-release can be found here:

yum install phpmyadmin

jQuery Ajax URL trick

Today I spent hours to get jQuery Ajax sending php emails works. It was just one tiny trick that I didn’t pay attention. I have to post it here just in case someone else had similar problem.

Environment: PHP 4, jQuery 1.44
Object: Ajax to send emails

First of all, here is a great tutorial: How to send email with php ajax and jquery

Now, I did the same thing as tutorial just modified some small parts (URL etc), and it didn’t work.
For instance, my main page is: http://<domain>/live/index.php/mail/index.php, and the PHP email file is in /live/ajax/mail.php  In $.ajax function, there is a variable URL to be specified, and here is the trick part.

URL I tried:

  1. ../ajax/mail.php  — It failed, because it was looking for http://<domain>/live/index.php/ajax/mail.php
  2. http://<domain>/live/ajax/mail.php — It failed, because something to do with the cross domain issue I think, wired thing is if Type = GET, it will work. If Type = POST, it won’t work.
  3. ../../ajax/mail.php — Worked.

So the URL levels should be based on the HTTP URL, not the folder levels.

Cobian Google App Mail Setting

I have been using Cobian 9 to backup Server files and working pretty well. A+++.

Here is the configuration for Cobian to send emails through Gmail (Google App).

*SMTP sender name=Cobian Backup 9
SMTP sender
SMTP port=465
*SMTP subject=%TASKNAME log %FORMATDATETIME=”yyyy-mm-dd hh:nn AM/PM”
*SMTP unicode headers=true
*SMTP unicode body=true
SMTP logon=true
SMTP user
SMTP password=your_password
SMTP pipeline=false
SMTP use Ehlo=true
SMTP Helo name=
SMTP proxy=no proxy
SMTP SSL: Implicit, TLSv1, Auto, Clear, Unassigned, 0, deselect the remaining options

*These settings are not critical.

Port 587 AND SSL Explicit should also work.

Send Magento Email through Google App

To improve server security and performance, it is suggested to set up Magento to send email through external mail server.

Here I would like to share my experience of setting up Magento to send emails through Google App (GMail).

  1. Install this free extension: SMTP Pro Email
    By the time I writing this, the extension requires you set to Alpha mode to be able to install.
  2. Magento Admin -> System -> Configuration -> Left Menu: Advanced -> System -> SMTP Pro Email Settings:
    Enable SMTP Pro Email: Yes
    Authentication: Login
    Username: (Your Gmail or Google App account)
    Password: Your password here
    Port: 465
  3. Click: Save Config
  4. Do a test by click “Run Self Test”

If you are experiencing error messag:

Warning: call_user_func(Zend_Validate_Hostname_Com::getCharacters) first argument is expected to be a valid callback

It may be because your Magento is installed on Zend server and got libraries conflicts with the Zend library comes with Zend Server. To fix, please:

  1. Edit /usr/share/magento/lib/Zend/Validate/Hostname.php:
    Replace: if (Zend_Loader::isReadable($classFile)) {
    With: if (file_exists($classFile) && Zend_Loader::isReadable($classFile)) {

Hope you find this helpful. Let me know.

Zend Magento Installation Guide

For a successful e-commerce website, the speed is very important. That’s why we need to consider Zend Server + Magento.

Here is a quick installation guide to help you get started.

Environment: VPS from Rackspace (Centos 5.4)

  1. download zend+magento from Magento Download Page
  2. modify zend.repos.rpm in [ISV] section:  (This could be a bug in the installation script)
  3. run ./   (This will install everything for you. Apache2, Zend, MYSQL, Magento ….).
  4. Open Server firewall to allow access from port: 80 and 10081 (Zend Server Console)
    iptables -I RH-Firewall-1-INPUT 9 -p tcp –dport 80 -j ACCEPT
    iptables -I RH-Firewall-1-INPUT 9 -p tcp –dport 10081 -j ACCEPT
  5. visit http://<yourserver>:10081 to change zend server admin password
  6. Change MYSQL password:
    mysqladmin -u root password <new password>
    mysqladmin -u root -h <local hostname> <new password>
  7. Create a MYSQL user just for Magento:
    grant all privileges on magento.* to magentodbuser@localhost identified by ‘magentodbpassword*’
    vim /usr/share/magento/app/etc/local.xml
    to put new dbuser and dbpassword in Magento’s configure file
  8. I don’t know what’s default password to login to Magento Admin Panel, so I changed it directly in MYSQL:
    go to magento database to change password for admin user:
    update admin_user set password = MD5(‘temppassword’) where user_id = 1
  9. After login to Magento Admin Panel, you will get a warning message to change {baseurl}, and here we go:
    in admin panel, system configuration, web, UnSecure and Secure
    change {{base_url}} in Base URL (only) to http://yourdomainname
  10. Done.

Let me know if it helps. Thanks.

MobileSync has stopped working

A lot of people are experiencing this issue: iPhone sync with Outlook through iTunes, crashed.

One of my client has this problem and I have managed to get this sorted out. Here is the solution and hopefully it helps someone.

Environment: Windows Vista 64bit, Outlook 2007, iTunes latest version (9.x), iPhone 3GS.

Errors: MobileSync has stopped working… then “Data Execution Prevention …”


  1. Open your Windows Event Viewer (Computer->Management).
  2. Check Logs under Windows -> Application
  3. You will see an error message regarding ‘mobilesync’. Find out the .dll file mentioned in the log. (my case is: LIBEAY32.dll)
  4. Now search this dll file in your whole system drive (C:)
  5. You should fount this file in at least two locations: one is in Windows \ folder or subfolder, the other one should be in Apple folder. The one is Apple folder should be newer than the one in Windows folder, according the file date.
  6. Now simply rename the one under Windows folder, say: LIBEAY32.dll to LIBEAY32.dll.original
  7. Now try again to sync your iPhone with iTune
  8. It should work! If not, repeat from 1-7 because you may have more .dll files to rename.

Hope that helps and let me know what your think.