Reputation: 3
A file named test.html contains:
hello
It takes a few milliseconds to respond.
A file named test.php contains:
hello
This one takes a few seconds to respond. They're both the same code and contain no actual PHP code. The file extension is the only difference!
I'm loading both via http://localhost/test.html or php
Is there any common snafu in the server settings that I missed? I'm using the standard Ubuntu 11.04, Apache2, PHP5 configuration.
Your help is appreciated... let me know what other details you need.
Upvotes: 0
Views: 5401
Reputation: 10888
If you want to get an idea what is going on try the following:
sudo -i
stop apache2
. /etc/apache2/envvars
apache2 -k start -X &
strace -u www-data -tt -ff -o /tmp/strace $(ps -o "-p %p" h -u www-data) &
man strace
to find out what it does and don't forget to apache2 -k stop
and start apache2
when you are done :) Remember you are all-powerful as root so come out ASAP.
Try adding an .htaccess
file and also doing a sudo apt-get install php-apc
to see how an Opcode cache works. The next stage is to strart downloading the source and matching this up to what is happening in the system trace. Enjoy.
Upvotes: 1
Reputation: 12843
Well even if there is no actual php code in your php file its getting sent to the php parser by apache because of its extension. This probably slows it by a few miliseconds and on your system might be more.
Like others have pointed out you probably have some module that is taking too much time. But about your original question my answer stands. Even without code your php file is getting parsed by php.
Upvotes: 1
Reputation: 1441
Even though there's no PHP code, it is being parsed as PHP. The problem could exist with Apache's configuration / installed modules, or possibly if you have a bunch of (or any one problematic) enabled module(s) in PHP.
Upvotes: 0