Jump to content

PHP 5 to PHP 4 errors


Full-Demon

Recommended Posts

Hi,

 

My homeserver has php5 but my webserver php 4.4.2, I'm getting some errors when I try to run a script in php4.

 

1. WWW-Authenticate doesn't work. It keeps asking me my UN and PW while I filled in the correct UN and PW. Script:

 

if (!isset($_SERVER['PHP_AUTH_USER'])) 
{ 
    header('WWW-Authenticate: Basic realm="Administration area"'); 
    header("HTTP/1.0 401 Unauthorized"); 
    exit; 
}     
elseif (($_SERVER['PHP_AUTH_USER']==$ini['c_admin_username']) && ($_SERVER['PHP_AUTH_PW']==$ini['c_admin_password']))
{
   [rest of code here]

 

Like $_SERVER['PHP_AUTH_USER'] is not set or something, wtf?

 

2. My error handling is redirecting me to the error page (with header();). How ever, to find out what is wrong, I add "echo 'some nonsense';" on top of the page. That way a header is already send and he will display the errors instead of redirecting me. This works in php5, but php4 just keeps redirecting me even if php already sended a header...how can this ever be possible???

 

Does anyone know the answer? I'm getting really frustated with the fact it DOES work in php5 but not in php4.

 

Thanks for any advise or reply,

 

FD

Link to comment
https://forums.phpfreaks.com/topic/63007-php-5-to-php-4-errors/
Share on other sites

No it doesn't work. I used print_r(); to display the complete array of $_SERVER and $HTTP_SERVER_VARS. Both didn't contain any information about the authentication. Can authentication be set off in php.ini by the server administrator? Perhaps thats the problem? Same for the header(); problem, is that something the server admin could have set on in php.ini?

 

Thanks anyway,

 

FD

Link to comment
https://forums.phpfreaks.com/topic/63007-php-5-to-php-4-errors/#findComment-313801
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.