I had such question some months ago. Now to isolate the problem I tried a new approach. I put an empty file to my server.
File name is "foobar.php". Its content is as follows:
<?php
echo "hello world";
But when I try to enter to example.com/foobar.php, I get
DNS 203 mseconds
Connect 3.33 seconds
Send 0 miliseconds
Time to First Byte 17.35 seconds
Receive 1 miliseconds Total load time 20.88 seconds
Then I put another file called "foobar.txt". Its content is as follows:
hello world<br/>
Loading time of foobar.txt is approximeately 0.2 seconds.
This website is inside a shared hosting so I can't get a root Linux access. I'm trying to find out what makes my site slow.
- When I get these results I have 60 visitors in my site. And they send AJAX requests when they are active. When they are active they send an AJAX request nearly every 3 seconds.
- Generally my website has 5-20 requests per second.
- My hosting provider says that there occurs no CPU overload, it is very low generally.
- I asked hosting company for Apache limits. I get this values for the whole shared server:
MaxClients 300
MaxRequestsPerChild 4000
ThreadsPerChild 25
- example.com/mybigpage.php and example.com/foobar.php pages are opened nearly at the same time.
- If page has txt, jpeg or other extensions they are opened instantly. If extension is php it opens very slow.
- CakePHP stores session files inside "/httpdocs/app/tmp/sessions" folder. Session files are deleted after two hours of creation. Now there is 3653 files inside that folder. Oldest file is created 2,5 hours ago.
- In my configuration, PHP handler is Apache module mod_php
New Edit: I talked with my hosting company. And told them that "foobar.php" is opened nearly in 20 seconds. Although that file has no code at all. They told me that they put "foobar.php" to other websites that we use same server. I also tried "othersite.com/foobar.php". It opened instantly. But "mysite.com/foobar.php" opened nearly in 15 seconds. What would make this behaviour? We use same PHP configuration with other sites, but they open instantly.. Can it be because of my .htaccess rules? Or other thing?
New Edit2: My provider told me that there exists no "apd.so" file inside the server. So it seems like I can't use APD.
What should I look for to find the bottleneck?
What would limit my site?
Additional data: from the phpinfo, I get this:
'./configure' '--prefix=/usr/local/lsws/lsphp5' '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--target=x86_64-redhat-linux-gnu' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib64' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.dd' '--disable-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-curl' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-libexpat-dir=/usr/lib64' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-wddx' '--with-kerberos' '--enable-ucd-snmp-hack' '--with-unixODBC=shared,/usr' '--enable-shmop' '--enable-calendar' '--with-libxml-dir=/usr' '--with-mysql' '--with-mysqli' '--with-gd' '--enable-dom' '--disable-dba' '--without-unixODBC' '--enable-xmlreader' '--enable-xmlwriter' '--with-mcrypt' '--enable-mbstring' '--with-litespeed' '--enable-soap' '--with-xsl' '--with-pdo-mysql' '--with-pdo-sqlite' '--enable-sqlite-utf8' '--with-pspell' '--with-sqlite=shared' '--with-xmlrpc' '--with-mhash' '--enable-pdo' '--with-imap' '--with-imap-ssl' '--without-suhosin' '--with-tidy' '--enable-zip' '--enable-inline-optimization' '--enable-gd-native-ttf' '--enable-bcmath'
print_r(get_included_files());
in your "empty" php file - if you are not infact loading an empty file - it will tell you which files you've loaded first. if you don't haveapp/webroot/
as your domain's doc root - you have to consider whatever mod_rewrite rules you've added. – Holofernes