• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 439
  • Last Modified:

same script different server:: header already sent error

A a test server I am using "Easy PHP Contact Form" On the live site it works, but on test server I get headers already sent errors:
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/me/domain.com/contact.php:81) in /home/me/domain.com/contact.php on line 106

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/me/domain.com/contact.php:81) in /home/me/domain.com/contact.php on line 106

Warning: include(form-header.php) [function.include]: failed to open stream: No such file or directory in /home/me/domain.com/contact.php on line 321

Warning: include() [function.include]: Failed opening 'form-header.php' for inclusion (include_path='.:/usr/local/lib/php:/usr/local/php5/lib/pear') in /home/me/domain.com/contact.php on line 321

Open in new window


Any ideas why that is?
0
rhandalthor
Asked:
rhandalthor
  • 5
  • 2
  • 2
4 Solutions
 
ludofulopCommented:
hi, check your php.ini, and comment out output_buffering

output_buffering = On
0
 
Dave BaldwinFixer of ProblemsCommented:
Your error message says they were sent at line 81.
0
 
rhandalthorAuthor Commented:
@DavidBaldwin. Same script works well at tiffinsolutions.com/contact.php and not at ts.imagewize.com/contact.php. What has changed? The server. But what has changed and how to fix this?
@ ludofulop Can this be done with a .htaccess? I do not have a dedicated server, just a DreamHost shared server.
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
Dave BaldwinFixer of ProblemsCommented:
The server and the error response has changed, simple as that.  If the original server is set to not report warnings as many are, maybe it's not working so well as you think.

Whenever you are having a problem with a PHP script, you should put this at the top of the script so it will report all errors so you can fix them.

error_reporting(E_ALL);
ini_set('display_errors','On');
0
 
ludofulopCommented:
setting it using .htaccess depends on your server configuration, try to put following line into .htaccess:
php_value output_buffering "On"

If it result #500 error, then you can't set it using .htaccess. Check your hosting, if you can use your own php.ini (some servers are allowing this).

If not, check your codes to prevent any output before session_start,
or put session_start to very top of your scripts (e.g. top of the first file loaded),
or use your own buffering  -  check out function ob_start, of_end_flush, etc.
0
 
rhandalthorAuthor Commented:
Done DaveBaldwin. Code is here: http://pastebin.ca/2052770 and live view - the same errors as far as I can see is here: http://www.ts.imagewize.com/contact.php. Perhaps Dreamhost reports more errors then previous server does. Need the script to work well on both ..
0
 
rhandalthorAuthor Commented:
Removed two errors. Looking into final one(s)
0
 
rhandalthorAuthor Commented:
0
 
rhandalthorAuthor Commented:
I did not mean to give myself points. Only the two contributors. Please adjust or allow me to award points again.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

  • 5
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now