How to find long running PHP script

Is there a neat way to get some metrics on script runtimes with Apache?

I'd like to find the longest running php script on my website (mean, median, ..). Since I have more than 50 scripts I wanted to know if there is some automated way to find the slowest script.

Some metrics concerning includes would also be nice. Which script recursively includes the most others? etc

I have SSH access to my webserver running Ubuntu server 14.04. Maybe there is some local application that helps benchmarking my scripts that I don't know about?

How can I create a keystore using an existing CSR file?

I have a website in GoDaddy (Apache) and an application in Amazon AWS (Apache Tomcat).

Website domain (apache):

Application domain (apache tomcat):

I know how to install the certificate for in GoDaddy, I use this application to generate the CSR and Private Key:

I copy the CSR to request the certificate and finally install it fine using the private key.

I know how to install the certificate in tomcat for creating a keystore then requesting the signature using the csr of the keystore generated and finally downloading the certificate and installing it, that's easy.

But I have a problem, I can use only one solution : Install the website certificate or install the tomcat certificate, but not both. Why? Because the CSR generated by the generator is different of the generated by the keystore, and I need the private key (that the generator gives).

Then, that's the reason of my question, how can I create a keystore using an existing CSR file?

Well my idea is to create the keystore using that CSR file (maybe exists a parameter for keytool), then using it to generate a new certificate. After this I can install in Apache and tomcat, How can I do it?

Maybe another solution is how to get the Private Key of a keystore, it will works too.

Apache tomcat master slave setup

I searched a lot but did not find much of information about master-slave setup for Apache tomcat, all I found was clustering.

our need is to have one master and multiple slaves with different services on each. Please suggest any such site or documentation from where we can take it ahead.

php index switch case issue

My .htaccess removes extensions (.html) and gives string to index.php where I have switch statement.

The switch works great except when the string starts with "index.php/"

ie. if the url is:

the string will be:


and it will show my index page without styling.

So how would I implement if the string starts with "index.php/" to show error page?

Is there some way like:

case "index.php/*":
      include ('error.html');

Website URL for a file with a trailing slash being interpreted as a directory and not 404ing?

We have recently been experiencing troubles with a customer's website where if you enter a URL such as (note the trailing slash):

It will return the index page of the website but without any css. There is no directory on the server of the site called foo.php, but there is a file called such. If you were to go:

It will return foo.php but without any css. Essentially, you can go to any page on the website and put a trailing slash on the end and it will look like it is accessing the root of the web server.

This is causing problems of duplicate content and mobile usability / html errors in our webmaster tools. I've had a thorough look across the web, and have been unable to find anything that could be causing this. I've removed our .htaccess file from the server, and tested the problem again, but it didn't solve it.

We need to know whether it is possible to stop this 'nesting' occurring, and if we can

We're using PHP 5.3 on an Apache server, hosted by GoDaddy. I don't know whether it is okay for me to post the website, so I'll hold off until told otherwise.

Thanks for your time.

Need .htaccess help: nonexistent urls 301 redirecting to 404, instead of giving direct 404s

Im having an issue with my joomla site. At first it would create duplicates of urls with and without trailing slash. So I implemented some htaccess code to force a trailing slash. Then it was causing soft 404s that is, if I entered a non existent page the status in my crawler was actually 200 for these non existing pages, but it was just a 404 page template. Not a hard 404. So I changed that in the "error.php" file.

However the issue is that when I enter any non-existent url like "" (without a trailing slash) it first redirects it via the 301 rule to the "" and THEN returns a 404.

If I stop the redirecting of pages, than that same URL "" will return a hard 404 as expected, but the URLs wont redirect to the trailing slash version (which I need). However if I redirect it, it will 301 before 404ing.

I dont have any pages on my site that are not without a trailing slash, so I want all pages other than those that return 404s to go straight to my "error.php" file and be excepted from the 301 rule. How would I do this? Here is my coded attempt

RewriteCond %{REQUEST_URI} !-d 
RewriteCond %{REQUEST_URI} !-f 
RewriteRule .? - [S=1] 
RewriteCond %{REQUEST_URI} !(.*)/$ 
RewriteRule ^(.*)$$1/ 
RewriteRule .+ - [L]

Im very inexperienced with htaccess. the idea was that if the file is non existent that the slash rewrite rule should be ignored.