Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Don Shipley
Don Shipley
19,488 Points

PHP header()

On php.net it shows, void header ( string $string [, bool $replace = true [, int $http_response_code ]] ) Does this mean the header() no longer works??

Don Shipley
Don Shipley
19,488 Points

Works on my localhost but after uploading to SiteGround (my server) it does not redirect the status. Just opens a white screen.

3 Answers

header has not changed, the $replace and $http_response_code are optional variables you don't even need to use them.

Don Shipley
Don Shipley
19,488 Points

Thank you James. I do not understand how it will work on my localhost but after uploading why it will not work on the live server. Worked on it for the past two day and there support will not help.

you should turn display_errors On either in your .htaccess or php.ini file.

Put this at the top of your .htaccess file to see if header spits out any errors.

php_flag display_errors On
Don Shipley
Don Shipley
19,488 Points

Thank you James. When I place that in top on my .htaccess I get a 500 error Looking up the error files and has to do something with my htaccess Will work on it Thank you again James