Drupal is slow on localhost?

posted Jun 20, 2011, 10:37 PM by admin@ revitviet.vn
Solution: Zend server      

Problem: Slow Drupal 6.x on windows with over 30 contrib modules enabled. On Mac OS X and Linux, Drupal runs very fast but when i try to run same site under windows, it makes me cry.

I've tried hundreds of solutions but finally zend server ce was the correct solution. I was using xampp 1.7.3, then downgraded to 1.7.1 because of php 5.3 incompatible modules (such as imagecache). All problems fixed but performance. I prefer a portable server because when i have to reinstall windows, i don't want to backup my data, reinstall server software, reconfigure them and import/export databases. Zend sever is not portable but you won't need it to be portable, here is what you need to do:

  • If you have a working xampp stop apache server, if you don't, setup a new xampp server (possibly in D: drive or somewhere else except system partition)
  • Only mysql server must be run from xampp (mysql as service is preferred)
  • Download Zend Server Community Edition from http://www.zend.com/products/server-ce I prefer PHP 5.2.x version for compatibility with some modules.
  • Install Zend Sever into default location and default installation options (don't include mysql)(maybe you can include phpmyadmin)
  • If Zend Sever is running stop it. To do this, look at apache system tray icon
  • Edit Zend server httpd.conf to point your xampp htdocs folder. To do this change "DocumentRoot" entry in httpd.conf into your full xampp htdocs path. You can use backslashes.
  • Scroll down httpd.conf file and seek for an entry which starts with <Directory "C:\Program Files\Zend\Apache2\htdocs">. Change this path to your full xampp htdocs folder.
  • Under this Directory entry seek for "Allow Override None" line. Change this to "Allow Override All" for clean url's support.
  • Your sever is ready to go, mysql is running from xampp and you can start Zend server from apache system tray icon.
  • You can configure zend server from its own control panel which can be accessed fromhttp://localhost:10081
  • Zend server hides php error messages and displays a HTTP500 internal server error page. To output php errors you must change a php directive. You can do this via Zend server control panel. Just go to Server setup > Directives > Error handling and logging. Just click on to output all php errors and warnings.
  • You can enable/disable all php extensions, and modify all php directives from this panel.
  • Don't forget to click "Restart PHP" button after you changed something.

That's all. After migrating Zend Server you will see a noticable performance boost. My last Drupal installation have 38 contrib modules enabled and admin/build/modules page loading time reduced to 1.5-2 seconds from 5-6 seconds. My machine is Core2 Duo 2.13 GHz, 2GB DDR3 RAM.

Don't worry about your server's portability. Mysql is still portable and you don't need to import/export or reconfigure your database server. When you want to reinstall your server, just install Zend Server with default options and change httpd.conf or replace with a preconfigured httpd.conf.


Other comment:

I had a problem of clean url's not working though after installing Zend Server CE.
I had to change AllowOverride none to AllowOverride All in file:///C:/ProgramFiles/Zend/Apache2/conf/httpd.conf.
I was also getting this warning:
warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for '-5.0/no DST' instead in C:\xampp\htdocs\drupal_shared\html\sites\all\modules\token\token_node.inc on line 40.
date.timezone was not set in C:/Program%20Files/Zend/ZendServer/etc/php.ini in
Changed it to date.timezone = "America/New_York"