I'm running an ExpressionEngine site using CartThrob for a shopping cart. Some of the pages are loading extremely slowly on the production server (7, 10, 15 seconds of Controller Execution Time as reported by CodeIgniter profiler), even when there is no traffic at all to the site. The same pages running on a dev server with the exact same codebase and exact same database are taking less than one second to load by the same measure. The problem seems worst on pages with lots of database queries, though that could be a red herring.

At first, I thought the issue was with the database or the connection to the database, but the CodeIgniter profiler indicates that the sum of all database queries on production for the slowest page (180 queries) is only about 0.6 seconds. Looking at the CodeIgniter database driver source, that number appears to be measured in PHP, so it seems like the problem is not in the database or the connection to the database.

In addition, looking at the Template Debugging log on production, there doesn't seem to be a single step that takes an inordinately long time. Rather each step seems to take just generally longer than on the dev server.

My local development machine is a Macbook running MAMP, and the Server is a 4GB Linode VPS running Ubuntu. I have separately benchmarked PHP/MySQL performance on both, and the Macbook was slightly faster at InnoDB selects, inserts, and updates, but not considerably so. I also benchmarked disk read/write on both machines, which came back almost identical. Just to check, I also migrated to another Linode server but the results are the same.

What else should I look into as to what might be causing this problem?

  • Check the Net tab in FireBug. Might me some external load.
    – Anna_MediaGirl
    Dec 14, 2013 at 3:10
  • Can you check your PHP memory_limit on both your development and production machines, and add that detail in your post? Just worth double-checking whether your server is configured with a low PHP memory_limit since it wouldn't necessarily be a high limit, even though you have 4GB of memory on your server.
    – Jay F
    Dec 16, 2013 at 3:01
  • memory_limit is set to 128M, although according to the CodeIgniter profiler, this request is only using 17M of memory
    – Travis
    Dec 16, 2013 at 14:55
  • Hi, I have the same problem very slow performance, pages loading slowly as you described. I discovered that the slow down performance is caused when index.php is removed via .htaccess. I tried many .htaccess commands(included the official inside EE guide), and when index.php is removed it's very slow, when it's not, the pages flies (1-2 s). I guess in my case would be an EE problem (module, extension, plugin...).
    – Stéphane
    Jan 13, 2014 at 19:12

4 Answers 4


I'd guess it's not EE.

Check the Network tab in FireBug or whatever browser dev tool you use.

Check apache, mysql and php error logs too.

Another good test is to reduce the code... Remove all and put pieces back in and test until you isolate the problem code.


Did you try the following:

  • enable / disable Gzip (under Admin -> System Administration -> Output and Debugging Preferences)
  • Are you using AutoMin? If so try to enable / disable "Enable Caching"

  • Does your server has hardware caching, if so. disable software Caching...

  • Some servers only allow caching or other settings be set trough .htaccess

Although I use Linode as a host and have generally been happy, my experience is that php runs really slow on their boxes. Way slower than in your local Macbook Pro environment.

I've experienced over 50% CPU 'steal' as well which is a bit annoying. My advice would be to consider a dedicated server if you can't optimise your site any more.

One more piece of advice - get New Relic on there and you'll have a much clearer idea of where the problem is. From what I've found, it's not the database that is the bottleneck, but php.


I encountered the same problems after to a Wamp upgrade (2.4). An other strange problem occurred too: the .htaccess files to remove index.php, no more was recognized by the local Apache server.

So i've found this solution putting this code inside httpd-vhosts:

<VirtualHost *:80>
    ServerName localhost
    DocumentRoot "D:/Dropbox/www/mysite"
    ErrorLog "logs/localhost-error.log"
    CustomLog "logs/localhost.log" common

    <Directory "D:/Dropbox/www/mysite">        
        allow from all
        order allow,deny
        AllowOverride All

And now the .htaccess is recognized and working fine, but the page loading was very very slow (8-10 seconds).

I tried many .htaccess parameters, include the official one in the EE doc. With this one, the performance is very good (0.5 seconds):

# Dont list files in index pages
IndexIgnore *

<IfModule mod_rewrite.c>

  # Enable Rewrite Engine
  # ------------------------------
  RewriteEngine On
  RewriteBase /

  # Redirect index.php Requests
  # ------------------------------
  # RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
     #RewriteCond %{THE_REQUEST} !/system/.*
  #RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,L]

RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteCond %{THE_REQUEST} !/system/.*
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,L]

  # Standard ExpressionEngine Rewrite
  # ------------------------------
  RewriteCond $1 !\.(css|js|gif|jpe?g|png) [NC]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ /index.php/$1 [L]

RewriteCond %{QUERY_STRING} ^(ACT=.*)$ [NC,OR]
 RewriteCond %{QUERY_STRING} ^(URL=.*)$ [NC,OR]
 RewriteCond %{QUERY_STRING} ^(CSS=.*)$ [NC]
 RewriteRule ^(.*)$ /index.php?&%{QUERY_STRING} [L] 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.