how to start session

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
yasir_memon
Forum Commoner
Posts: 48
Joined: Tue Aug 11, 2009 12:29 am

how to start session

Post by yasir_memon »

i have 10 php pages and i am using session in each page where i write session_start() on each page is there any way that i only start session on one page and automatically it starts on every page.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: how to start session

Post by VladSun »

Turn on the ’session.auto_start’ option in your php.ini
Last edited by VladSun on Thu Sep 03, 2009 1:36 am, edited 1 time in total.
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
bala_1225
Forum Commoner
Posts: 29
Joined: Tue Jul 28, 2009 3:20 am
Location: chennai,india

Re: how to start session

Post by bala_1225 »

hi u need to start session at the very first line in each and every page......
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: how to start session

Post by Christopher »

Moved to the PHP -Code forum.
(#10850)
yasir_memon
Forum Commoner
Posts: 48
Joined: Tue Aug 11, 2009 12:29 am

Re: how to start session

Post by yasir_memon »

is this not php code form?????????
User avatar
pcoder
Forum Contributor
Posts: 230
Joined: Fri Nov 03, 2006 5:19 am

Re: how to start session

Post by pcoder »

You can start the session on common page. You do not need to start at every pages..
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: how to start session

Post by pickle »

If each of your PHP pages has a common file they include, you can put session_start() in that file.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply