FORUM HOME | WHUK BLOG   
WEB HOSTING UK AFFORDABLE WEBSITE HOSTING SERVICES IN UNITED KINGDOM
PHP LINUX SHARED HOSTING WINDOWS ASP.NET HOSTING PACKAGES
ECOMMERCE HOSTING ASP MSSQL MS ACCESS ODBC FRONTPAGE HOSTING
CPANEL WHM FANTASTICO RESELLER DEDICATED SERVER WEB HOSTING
CHEAP PLESK CPANEL HTML MYSQL BEST UK VPS HOSTING COMPANY
CHEAP RELIABLE UK HOSTING PROVIDER SINCE 2001
MANAGED WEB HOSTING SERVICE
AFFORDABLE WEBSITE HOSTING SERVICES IN UNITED KINGDOM

Web Hosting UK Forums | Linux Windows Dedicated Server and cPanel VPS Hosting Forum » Technical Support » Linux Dedicated Servers

Reply
 
LinkBack Thread Tools Display Modes

  #1 (permalink)  
Old 23-08-11, 05:09 PM
new member
 
Join Date: Aug 2011
Posts: 2
Default Warning: mail() has been disabled for security reasons

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 : )
Reply With Quote

  #2 (permalink)  
Old 23-08-11, 06:59 PM
Cust. Interaction Assoc.
 
Join Date: Aug 2011
Posts: 149
Send a message via Skype™ to bastones
Default

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 View Post
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 : )
__________________
Regards,
Ben Stones

Customer Interaction Associate

Need to contact us?

Support - 0808 262 0606 or
support.webhosting.uk.com

Customer Relations - 0808 262 0855 or
support.webhosting.uk.com

Sales - 0800 862 0890 or sales@webhosting.uk.com


Contact me
ben@webhosting.uk.com
Skype ID: whuk_ben
Reply With Quote

  #3 (permalink)  
Old 23-08-11, 07:36 PM
new member
 
Join Date: Aug 2011
Posts: 2
Default

Thanks for the response - I'll take a look at the header issue, but as you say, it'd be useful to get a response about the mail() function.

To be fair, it's a temporary website so I'll probably come up with a permanent and more efficient bit of code later, it's just a pain that I can't throw this up quickly when it works just fine on my own server.
Reply With Quote

  #4 (permalink)  
Old 23-08-11, 07:45 PM
Cust. Interaction Assoc.
 
Join Date: Aug 2011
Posts: 149
Send a message via Skype™ to bastones
Default

Quote:
Originally Posted by Acteon View Post
Thanks for the response - I'll take a look at the header issue, but as you say, it'd be useful to get a response about the mail() function.

To be fair, it's a temporary website so I'll probably come up with a permanent and more efficient bit of code later, it's just a pain that I can't throw this up quickly when it works just fine on my own server.
No problem Acteon. You are welcome to open a support ticket and ask them to enable the mail() function on your server as it is currently disabled for security reasons.
__________________
Regards,
Ben Stones

Customer Interaction Associate

Need to contact us?

Support - 0808 262 0606 or
support.webhosting.uk.com

Customer Relations - 0808 262 0855 or
support.webhosting.uk.com

Sales - 0800 862 0890 or sales@webhosting.uk.com


Contact me
ben@webhosting.uk.com
Skype ID: whuk_ben
Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT. The time now is 09:13 PM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Copyright 2001-2010 Web Hosting UK. All rights reserved.
Web Hosting UK Forum





Site Map

Shared Cloud
Shared Cloud From £1

Affiliate Program
Earn up to £300 Per Sale

Dedicated Servers
Dedicated Server Hosting

Cloud Hosting
Cloud Server Hosting

Load Balanced Server
Load Balancing Server

VPS Hosting
Linux VPS Hosting

Windows VPS
Windows 2003 VPS

Zimbra Hosting
Zimbra Email Hosting

cPanel Hosting
Shared Linux Hosting

Windows Hosting
Shared Windows Hosting

Coldfusion Hosting
Windows Coldfusion Hosting

cPanel Reseller Hosting
Reseller Hosting

Windows Reseller
Windows Reseller Hosting

Email Web Hosting
Email Hosting

Semi-Dedicated Server
Semi-Dedicated Hosting

Remote Backup Plans
Offsite Backup Service


cpanel hosting
Knowledgebase Articles

Pre-Sales Question
Web Hosting FAQ's

Dedicated Hosting
Dedicated Server FAQ's

Virtual Private Servers
VPS Hosting

PHP MySQL Hosting
cPanel Hosting

Windows Hosting
ASP MSSQL Hosting

Domain Name
Domain registration FAQ's

CMS Hosting
CMS Hosting FAQ's

Payment Gateways
Payment FAQ's


Support Tutorials

cPanel Tutorials
cPanel Flash Tutorials

Wordpress Tutorials
Wordpress Flash Tutorials

Plesk Tutorials
Plesk Flash Tutorials

PhpMyadmin Tutorials
PhpMyadmin Flash Tutorials

Drupal Tutorials
Drupal Flash Tutorials

Mambo Tutorials
Mambo Flash Tutorials

Joomla Tutorials
Joomla Flash Tutorials

More Hosting Tutorials