July 6, 201115 yr Hi guys, Have just started implementing a members area in to my site which did previously work when I had it running through my site that I developed in htm/css but now I have integrated wordpress in to my site and basically rebuilt the site, it doesnt seem to want to play. Have created the SQL database and imported the relevant file, but I get the following lines appear at the top of my members page: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/adejones/public_html/wp-content/themes/pcc/members.php:38) in /home/adejones/public_html/wp-content/themes/pcc/members.php on line 38 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/adejones/public_html/wp-content/themes/pcc/members.php:38) in /home/adejones/public_html/wp-content/themes/pcc/members.php on line 38 Warning: Cannot modify header information - headers already sent by (output started at /home/adejones/public_html/wp-content/themes/pcc/members.php:38) in /home/adejones/public_html/wp-content/themes/pcc/members.php on line 41 line 38 is: <? ob_start(); session_start();include_once"config.php"; and line 41 is: header("Location: login.php"); Config.php is in the same directory but I've just had a thought that I havent actually made the login page yet so will this be the problem? And if not, I have had a couple of problems with wordpress picking up the correct paths so instead of just config.php, do you think it would be worth while trying the full path (http://www...... ) I thought i'd make the next page to go with this members area and see how that goes so made the settings page, but this gets the same lines at the top of the page and have noticed a few bits of the php code appear in the middle of the site too. You can see these pages here: http://www.primarycarecommunity.net/members/ http://www.primarycarecommunity.net/settings/ I would appreciate any help you can give, thanks. Adey
July 6, 201115 yr Hi guys, Have just started implementing a members area in to my site which did previously work when I had it running through my site that I developed in htm/css but now I have integrated wordpress in to my site and basically rebuilt the site, it doesnt seem to want to play. Have created the SQL database and imported the relevant file, but I get the following lines appear at the top of my members page: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/adejones/public_html/wp-content/themes/pcc/members.php:38) in /home/adejones/public_html/wp-content/themes/pcc/members.php on line 38 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/adejones/public_html/wp-content/themes/pcc/members.php:38) in /home/adejones/public_html/wp-content/themes/pcc/members.php on line 38 Warning: Cannot modify header information - headers already sent by (output started at /home/adejones/public_html/wp-content/themes/pcc/members.php:38) in /home/adejones/public_html/wp-content/themes/pcc/members.php on line 41 line 38 is: <? ob_start(); session_start();include_once"config.php"; and line 41 is: header("Location: login.php"); Config.php is in the same directory but I've just had a thought that I havent actually made the login page yet so will this be the problem? And if not, I have had a couple of problems with wordpress picking up the correct paths so instead of just config.php, do you think it would be worth while trying the full path (http://www...... ) I thought i'd make the next page to go with this members area and see how that goes so made the settings page, but this gets the same lines at the top of the page and have noticed a few bits of the php code appear in the middle of the site too. You can see these pages here: http://www.primarycarecommunity.net/members/ http://www.primarycarecommunity.net/settings/ I would appreciate any help you can give, thanks. Adey As far as i know, headers cant be sent out if something has been echoed/displayed so i cant do echo "hello"; header("Location: index.php"); it would have to be the header line first, so if the header is going to be used, run the PHP functions/script first and then run the necessary headers then echo the content also session_start() is usually on the first line after the opening php tags, so if you want to use sessions, you need to start the session before anything is echoed (and i think it has to go before the rest of the php script too not 100% sure though), so basically put your session_start(); at the very top of the php file after the <?php line <?php session_start(); //rest of code below
July 6, 201115 yr Author I think I may have cracked it, there was already a <?php at the top from wordpress because its a page template so just jiggled where it opens/closes and now its redirecting me to login.php (which I havent made yet) because i'm not logged in... Now just to make the other pages and see if it will go from there...
July 6, 201115 yr output started at /home/adejones/public_html/wp-content/themes/pcc/members.php:38 take a look what's inside that file, its sending your headers/echoing. anyhow, think about separating the business logic and the view part of your application, then you wouldnt have such problems
Create an account or sign in to comment