Web Hosting Talk







View Full Version : PHP error?


dgessler
11-16-2003, 07:54 PM
This is weird, when I try logging into my website's admin interface, I'm getting this error:


Warning: fsockopen(): unable to connect to 216.237.145.128:80 in /home/discount/public_html/admin/login.php on line 14

Warning: Cannot modify header information - headers already sent by (output started at /home/discount/public_html/admin/login.php:14) in /home/discount/public_html/admin/login.php on line 16


Does this have somethign to do with the webserver or the script?

Thanks,
Dan

Jakiao
11-16-2003, 07:58 PM
First off, wrong forum. This belongs in the programming forum.

Now, fsockopen() is just as it says, the ip it's trying to connect to can't be accessed.

Now, the header error is that whatever is causing that is being sent after normal php code. Move whatever it's complaining about to the top of the script with the other headers, if any.

Davros
11-17-2003, 12:47 AM
First thing is it can't connect.. I tried to connect to that IP and could not either.

Second thing is that it's trying to re-write the header. Older versions of php allowed scripts to do that. 4.3.2 and newer will not. If this script was meant to run on older versions that could be the case.

Without knowing what line 14 and 16 say's its kinda hard to diagnose.

I was able to reach your site and find the login page and it worked.. I did not try to login, I assume this error is when you try to login? or have you fixed the problem?

Rich2k
11-17-2003, 05:59 AM
The second error is expected there.

The reason you are getting a header error is because PHP has already outputted the first error to the browser... then it carries on executing the script in which you have a header() function below it.

You can solve this type of thing by buffering the output and flushing it at the end of the script execution.

dgessler
11-18-2003, 12:30 AM
Originally posted by Rich2k
The second error is expected there.

The reason you are getting a header error is because PHP has already outputted the first error to the browser... then it carries on executing the script in which you have a header() function below it.

You can solve this type of thing by buffering the output and flushing it at the end of the script execution.

Uh huh.. ..I think I see.. :eek:

I think I'll need to talk to my host and see if they upgrading PHP recently or maybe changed IP's or something like this?

If he can't help I'd nee dto hire someone to help me fix this. Weird hwo it happened out of the blue..

null
11-18-2003, 01:32 AM
Post the code

Rich2k
11-18-2003, 05:50 AM
If you are trying to open a file on your own server... then don't go remotely to it. Just use relative paths.

There is also a bug with fopen in php4.3.3 (not sure about 4.3.4) where sometimes an fread() on a remote file will suddenly terminate after a certain number of characters. Using streams instead gets around that problem.