1

I have a legacy web site that I would like to host on a Plesk Onyx 17.8 web server. The web site is running fine on PHP 5.3 FastCGI.

The problem is that it is using the old fashioned ".php4" file extension. And since it is a legacy app I didn't develop myself, and is poorly developed, it is not an option to migrate the whole code base from .php4 to .php file extension.

The web site is configured in Plesk with the default architecture, with Nginx as front-end reverse proxy, and Apache as a back-end, serving php applications with FastCGI.

Which directives should I add to Apache and/or nginx to actually send the php4 files to the php engine ?

I know this old app is running fine with the PHP 5.3 FastCGI engine, it is currently hosted on a Windows 2012 / IIS 7.5 / PHP5.3 stack, so the only thing I need is to tell the web server to accept the .php4 file extension. I don't need to install any PHP4 runtime.

  • nginx : add index.php4 as a possible index file
  • apache : send php4 to the PHP 5.3 FastCGI engine
kall2sollies
  • 1,429
  • 2
  • 17
  • 33
  • It would be about as quick to convert the filenames and references as it would be reconfigure webserver. – symcbean Sep 18 '18 at 08:54
  • 1
    This app was previously hosted on Windows / IIS / PHP 5.3 and allowing php4 files was a 1 click / line config. I expect Plesk to be at least that easy. This app is so poorly developed that even the database contains references to php4 files ! – kall2sollies Sep 18 '18 at 08:59
  • 1
    You expect Plesk to support something that has been end of life for **10 years** (PHP 4 went EOL in Aug 2008) to be "that easy"? I'm sorry, but that is really unrealistic. – Oldskool Sep 18 '18 at 09:11
  • 1
    Yes I expect it to be that easy because using the 5.3 runtime is actually working. The only thing I need is the web server to treat the .php4 **file extension** exactly the way it would do for the php file extension. – kall2sollies Sep 18 '18 at 09:13
  • SO WHY DON'T YOU CHANGE THE EXTENSION AND STOP ADVERTISING YOUR VULNERABILITIES. If it was "previously" hosted on MSWindows, this rather implies its now on a more sensible platform - it takes around 3 lines of script on a POSIX host. – symcbean Sep 18 '18 at 11:17
  • I don't want to change them because it's a private app, so I don't care about vulnerabilities, it's a low budget customer so I don't want to spend more than a few minutes. I did try to replace contents and extensions, and now I'm stuck within an issue because `sed` changed all my encodings, and last but not least, references of php4 files are all around the database. If for some reason I wanted to refer to php files with .foo extension, I think I could, providing the appropriate Apache directives. My question is only about these directives, so providing a workaround is not answering question. – kall2sollies Sep 18 '18 at 11:42

1 Answers1

1

not sure that it will work. You can try to do following

Domains > example.com > Apache & nginx Settings

Index files - choose "Enter custom value" and enter index.php4

For "Additional directives for HTTP" and "Additional directives for HTTPS" set:

<IfModule mod_fcgid.c>
    <Files ~ (\.php4$)>
        SetHandler fcgid-script
        FCGIWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper .php4
        Options +ExecCGI
    </Files>
</IfModule>

"Proxy mode" must be enabled.

Elvis Plesky
  • 3,190
  • 1
  • 12
  • 21