?
Solved

php.ini vs. .htaccess  to select PHP4 instead of PHP5

Posted on 2014-02-19
5
Medium Priority
?
549 Views
Last Modified: 2014-02-21
supposedly the linux server this acct is on has both PHP4 and PHP5(default).
supposedly PHP4 is selectable on a per-directory basis
which mechanism (php.ini or .htaccess) do i use in that directory,
and what is the syntax of the PHP4 selection statement.

thanks!
0
Comment
Question by:willsherwood
5 Comments
 
LVL 12

Assisted Solution

by:Gregory Miller
Gregory Miller earned 664 total points
ID: 39872293
You might be able to make it even simpler than that. Try naming your file index.php4 and see if the host has that configured to do what you want. Another option is to start your script like this:

<?php4
     phpinfo();
?>

Open in new window


The PHP Info screen should tell you which version of PHP is processing your script.
0
 
LVL 84

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 668 total points
ID: 39872628
You should really ask your host about that.  It is not a standard feature.  It is likely that PHP4 will not be supported much longer since it is already been removed by most hosting companies.
0
 

Author Comment

by:willsherwood
ID: 39873091
i wish i didn't have to use it, i've gone to great lengths to find a host and acct that
still supports PHP4,  i have a script i still need to use.
there are about 50 files involved, so i cannot change all the references to file extensions.
0
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 668 total points
ID: 39873163
I expect you will want an addType statement.  Here is how I use .htaccess to get HTML parsed through the PHP parser.

AddType application/x-httpd-php5 .html .htm .php

That said, if you have PHP4 scripts you have a big problem and it's not going to go away until you upgrade them.  PHP4 is about a decade out of date.  Even PHP 5.2 is not supported any more, not even for security fixes.  PHP.net has migration guides that can help you move along from release to release, but with something that deeply backlevel, you probably want to consider a complete rewrite in the spirit of refactoring.  

You want to charge an hourly rate for the remediation work.  With most PHP4 scripts, there are a lot of code smells, the object model is incompatible, error reporting is minimal and, in sum, it may be faster to entirely rewrite the application rather than try to fix it script-by-script.

Good luck.  This can keep you busy for a lot of billable hours!  ~Ray
0
 

Author Closing Comment

by:willsherwood
ID: 39878585
thanks all
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month14 days, 5 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question