Running other file types as PHP (htaccess)

software development

#1

Hi – For legacy reasons too silly to explain, I have always named my PHP files filename.ph7 instead of filename.php; in addition, I use filename.inc for PHP includes in the construction of my site.

Up until last week, this line in my site’s .htaccess file was working splendidly to achieve these results:

AddHandler php-cgi .ph7 .inc

However, starting about five days ago, any filename.ph7 pages or pages which include filename.inc files are loading extremely slowly.

To wit:

http://www.onebee.com/test.html loads quickly
http://www.onebee.com/test.php loads quickly
http://www.onebee.com/test.ph7 loads very slowly

Does anyone know the AddHandler directive I should be using, which would ensure that filename.ph7 scripts are parsed by exactly the same PHP engine that automatically takes care of filename.php?

I am running PHP 5.2.x under FastCGI on my domain.

I’ve tried the advice on this page and on this page, but neither has not fixed the problem. Any advice will be greatly appreciated!


#2

Oh, silly legacy apps. I feel your pain (you don’t want to see my .htaccess).

Both of your PHPs are running pretty slowly for me, actually. Once the php loads, it seems to re-load faster, but yes, the ph7 is very slow.

You said that you’re using FastCGI, so why not use

AddHandler fcgid-script .ph7
FCGIWrapper "/dh/cgi-system/php53.cgi" .ph7

#3

Ipstenu, you have saved a life today. Or at least spared me any more nights of forehead-slapping anguish.

This seems to be working perfectly - and to answer your question the only reason I hadn’t done it is that I had no idea what the proper command was. The tough part about DH’s super-easy one-click PHP activation is there’s no way to know how to turn it on manually if need be.

Am I correct in assuming this directive is overriding whatever PHP settings I have on my domain in the control panel? So, as long as I don’t have any .php files, I could actually (theoretically) disable PHP on the control panel since Apache will be invoking it directly (on .ph7 files) due to these rules?

Thanks very much for the help! I was really starting to run out of options.


#4

I feel you, man! I had to play with this a little to figure out the syntax :slight_smile: (DH employee of just over a month)

No, don’t disable PHP. That will … disable PHP :smiley: This is extending it and telling your server “.ph7 is also a .php file”


#5

Ah. Very well. Hadn’t planned to disable it, but was just curious how the .htaccess command related to the process that runs automatically.

Thanks again for the help - and welcome to the DH family! We’re lucky to have you. :slight_smile: