Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 19th, 2006, 03:52 PM
Registered User
 
Join Date: Feb 2006
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 :)

 
Old February 20th, 2006, 07:26 PM
Registered User
 
Join Date: Feb 2006
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".






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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.