Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0
This is the forum to discuss the Wrox book Beginning PHP5, Apache, and MySQL Web Development by Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz, Michael K. Glass; ISBN: 9780764579660
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 19th, 2006, 03:52 PM
Registered User
 
Join Date: Feb 2006
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ch. 2 - Passing Variables with Sessions

Working on the first "Passing the Visitor's Username". Using Windows XP, PHP 5.1.2, Apache 2.1, kept getting "headers already sent" warning when viewing movie1.php.

What worked for me:

1. Created the c:\tmp directory (I don't know if this is still necessary)

2. Located php.ini file in c:\windows

3. Changed "session.auto_start = 0" to " = 1"

4. Saved the php.ini file

5. Deleted session cookie in my browser, closed browser

6. Restarted Apache (to get the changed php.ini info)

7. Voila! success ... hope this saves someone 24 hair pulling hours

Here is the background for those of you who are readers.

Kept getting the "headers already sent" Warning. I found this valuable insight at

http://phpbuilder.com/manual/en/ref....sion.save-path

Note: Prior to PHP 4.3.6, Windows users had to change this variable in order to use PHP's session functions. A valid path must be specified, e.g.: c:/temp.

In other words, you don't have to specify a path for session.save_path in your php.ini file as advised in paragraph 5, p. 47.

What you DO have to do though, is to is to set session.auto_start

; Initialize session on request startup.
session.auto_start = 1

The default setting is session.auto_start = 0.

I found another post saying changing session.cookie_path -

; The path for which the cookie is valid.
session.cookie_path = /

to "session.cookie_path = \" worked for them.

It works with the default setting. Don't waste your time on that one for the first example.

Now on to passing the username with a cookie. Settings in php.ini may have to be changed again :)

Reply With Quote
  #2 (permalink)  
Old February 20th, 2006, 07:26 PM
Registered User
 
Join Date: Feb 2006
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Even though that worked, I now know the easier solution is to set encoding in Notepad to ANSI when you do a save as, or better yet, switch to a quality text editor.

Works now with the "session.auto_start = 0".

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HUGE TIMESAVER - CH. 2 SESSIONS - tks001 Beginning PHP 0 February 19th, 2006 01:25 PM
Passing through sessions dmlocke BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 May 15th, 2005 11:35 AM
Passing Variables through Sessions dmlocke Beginning PHP 2 April 27th, 2005 05:40 AM
CH:2 Passing Variables throught a URL. GraphicArmy BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 5 April 28th, 2004 02:36 AM



All times are GMT -4. The time now is 09:25 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.