Hi Acteon,
In regards to the "headers already sent" error can be caused by using the
header() function in order to redirect users to a different page after any HTML code or output (including whitespaces). If this is the cause of the header error, you need to ensure the header redirect is used before any output whatsoever. To redirect using the header() function you would be using the code below:
Code:
<?php header("Location: file.php"); ?>
This could be one of the reasons as to why the script is outputting a "headers already sent" error. There could also probably be other causes as well but I would guess a big proportion of "headers already sent" errors are due to the above explanation.
If you developed the script yourself I would recommend checking lines 32 and 35. If it is due to the header() function it is best to add the header() function to redirect users, as an example, to the very top of the page before any output.
In regards to the mail() error, it looks quite unusual to me as I don't know why the mail() function needs to be disabled. But generally for a lot of mail it is better to use an
SMTP library than the mail() function because mail() opens and closes an SMTP socket for each e-mail, which isn't very efficient (as stated on:
PHP: mail - Manual). Some alternatives are to use an SMTP PHP library such as
SwiftMailer or the
PHP PEAR Mail() class. I would wait for a system administrator to check this thread and they will advise you as to whether you should keep it disabled or not (though I don't see why it needs to be disabled myself). If you want the mail() function enabling on your server, you can submit a support ticket to get this done for you free.
Hope this helps.
Quote:
Originally Posted by Acteon
Hi all,
I'm taking control of the cPanel for my client who hosts through WHUK, and for the life of me I can't get a simple PHP Mail() function to work. I've tried installing the service through the cPanel PEAR panel, but even with that in place, it's knocked out.
Currently I'm redirecting the site to my own server just to run the mail script, then back to WHUK, which is ridiculous.
The error I get is:
Warning: mail() has been disabled for security reasons in /home/xxx/public_html/test/form_script.php on line 32
Warning: Cannot modify header information - headers already sent by (output started at /home/xxx/public_html/test/form_script.php:32) in /home/xxx/public_html/test/form_script.php on line 35
Is there some way to enable this feature so that we can get the standard mailforms working, or is this restriction permanent?
Any help would be much appreciated, and might stop me from banging my head on the desk : )
|