View previous topic :: View next topic |
Author |
Message |
jonleow -
Joined: 29 Apr 2004 Posts: 48
|
Posted: Sat May 15, 2004 6:46 am Post subject: phpp header problem |
|
|
hi all, when i try to redirect a user to a website using the header function, i got this error message :
Notice: Undefined variable: location in C:\Program Files\Abyss Web Server\htdocs\do_direct.php on line 3
Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\Abyss Web Server\htdocs\do_direct.php:3) in C:\Program Files\Abyss Web Server\htdocs\do_direct.php on line 3
what does this mean and how can i correct it?
another problem: the mail() function cant seem to work too..here is the error emssage :
Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Program Files\Abyss Web Server\htdocs\mail.php on line 3 |
|
Back to top |
|
 |
iNaNimAtE -
Joined: 05 Nov 2003 Posts: 2381 Location: Everywhere you're not.
|
Posted: Sat May 15, 2004 8:16 am Post subject: |
|
|
As to the SMTP question, do you have an SMTP/Mail Server installed and properly configured? If you don't, you're going to need to get one. _________________ Bienvenidos! |
|
Back to top |
 |
 |
Moxxnixx -
Joined: 21 Jun 2003 Posts: 1226 Location: Florida
|
Posted: Sat May 15, 2004 10:46 am Post subject: |
|
|
Before you go installing any mailservers, I'd suggest testing to see if it will support
your existing SMTP settings that came with your email account your ISP gave you.
Look for this in your php.ini...
Code: | [mail function]
; For Win32 only.
SMTP = localhost ; for Win32 only
sendmail_from= moxxnixx@amerytel.net ; for Win32 only | Change localhost to your email SMTP setting. If you don't know it, go into Outlook Express
and look in Tools > Accounts > Properties to get it.
The line should now look like: Code: | SMTP = smtp.airstreamcomm.net ; for Win32 only | (those are my settings)
As for the Notice, go back into php.ini and find... Code: | ; Examples:
;
; - Show all errors, except for notices
;
;error_reporting = E_ALL & ~E_NOTICE
;
; - Show only errors
;
;error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR
;
; - Show all errors except for notices
;
error_reporting = E_ALL; display all errors, warnings and notices | Take away the ; on the line that says... Code: | ;error_reporting = E_ALL & ~E_NOTICE | (and make sure you put a ; on the one that didn't have one before)
And finally, to fix the Warning, look for this line... Code: | output_buffering = Off | Change it to On.
I know this probably seems like alot, but really, you're only changing 3 settings.
Hopefully, changing these should work. If not, let us know. |
|
Back to top |
|
 |
eznetlinks -
Joined: 27 Sep 2003 Posts: 144
|
Posted: Sat May 15, 2004 2:34 pm Post subject: |
|
|
Warning: Cannot modify header information - headers already sent by (
this warning means that something was sent to php.exe before the header() statement. headers must be sent to php first.
Incorrect:
echo "<html>";
header(Location: );
Correct:
header(Location: ); |
|
Back to top |
|
 |
jonleow -
Joined: 29 Apr 2004 Posts: 48
|
Posted: Sat May 15, 2004 4:07 pm Post subject: hi all |
|
|
thanks for the answers guys...i just came back and im going to try out the suggestions u ppl give...will let u all know if it's working..once again thanks. |
|
Back to top |
|
 |
masa -
Joined: 05 Apr 2004 Posts: 182 Location: Hong Kong
|
Posted: Sat May 15, 2004 4:19 pm Post subject: |
|
|
also i get that problem for my guestbook and i want that problem to be fixedc and how can i fix it please help me cuz i want to make my guestbook without bugs and i downloaded from hotscripts.com and before it was working and now its not so please help me _________________ Visit http://web26.hopto.org:443/ please help me make my site better http://web26.hopto.org:443/ |
|
Back to top |
|
 |
jonleow -
Joined: 29 Apr 2004 Posts: 48
|
Posted: Sat May 15, 2004 5:09 pm Post subject: to Moxxnixx |
|
|
hi Moxxnixx, i ve change the settings u told me to and now im able to redirect the users to a website i specify...however i still have some problem with the mail() function and now i got this error :
Error 200
OK
--------------------------------------------------------------------------------
Abyss Web Server X1
© Aprelium Technologies - 2001-2004
what's wrong? but later when i checked my inbox, i got the message...why the error 200 appeared on the screen? |
|
Back to top |
|
 |
Moxxnixx -
Joined: 21 Jun 2003 Posts: 1226 Location: Florida
|
Posted: Sat May 15, 2004 5:34 pm Post subject: |
|
|
Error 200 means that the script was executed but that it hasn't sent output to the server.
Try setting Register_globals to On in php.ini. Otherwise, check the configuration of the script.
-------------------------------------------------------
eznetlinks, you are correct.
The header() must be called before anything else is sent to the browser.
That's why I suggested turning output_buffering to On.
PHP automatically runs ob_end_flush() at the conclusion of a script
before it is sent to the browser. |
|
Back to top |
|
 |
jonleow -
Joined: 29 Apr 2004 Posts: 48
|
Posted: Sat May 15, 2004 6:16 pm Post subject: |
|
|
set the Register_globals to On and still the erro 200 is there. what do u mean by the configuration of the script?
forgot to thank u , eznetlinks and iNaNimAtE |
|
Back to top |
|
 |
Moxxnixx -
Joined: 21 Jun 2003 Posts: 1226 Location: Florida
|
Posted: Sat May 15, 2004 6:30 pm Post subject: |
|
|
What's the mail script you're trying to use? |
|
Back to top |
|
 |
jonleow -
Joined: 29 Apr 2004 Posts: 48
|
Posted: Sat May 15, 2004 6:40 pm Post subject: |
|
|
it's a very simple one...im a newbie to php so im trying out some script i read from a book entitled "Essentials PHP" by meloni... here is my script:
<?php
mail("gatecrash@hotmail.com", "hello", "You are the best", "from: \"Jon Leow\" <\"gatecrash@hotmail.com\">\n");
?> |
|
Back to top |
|
 |
Moxxnixx -
Joined: 21 Jun 2003 Posts: 1226 Location: Florida
|
Posted: Sat May 15, 2004 7:05 pm Post subject: |
|
|
The script is correct. But, there wouldn't be any output. So, the 200 error
is normal.
Did you check to see if the email was received?
Finish the rest of "Sending E-Mail" section in the book to create a page
that shows output.
Last edited by Moxxnixx on Sat May 15, 2004 7:14 pm; edited 1 time in total |
|
Back to top |
|
 |
jonleow -
Joined: 29 Apr 2004 Posts: 48
|
Posted: Sat May 15, 2004 7:08 pm Post subject: |
|
|
yes i got the mail...so it's normal for the 'error 200' to appear on the screen? is there anyway i can make it disappear? i dont want my future web surfers to get confused by it.
.
.
.
.
oh i got wat u meant...yeah it's working prefectly now..thank u so much! |
|
Back to top |
|
 |
Moxxnixx -
Joined: 21 Jun 2003 Posts: 1226 Location: Florida
|
Posted: Sat May 15, 2004 7:19 pm Post subject: |
|
|
I have that same book. Just finish the section on "Sending E-Mail".
I'm glad you got it to work.
Cheers, |
|
Back to top |
|
 |
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Mon May 17, 2004 2:26 pm Post subject: |
|
|
jonleow,
Error 200 means that you script was executed correctly but that it has sent no output to the server.
To fix the problem, add a simple echo statement such as:
Code: |
echo "The mail was sent.";
|
in your script code. _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
 |
|