Wrox Programmer Forums

Need to download code?

View our list of code downloads.

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

You are currently viewing the BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 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
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 30th, 2005, 06:03 PM
Registered User
Join Date: Oct 2004
Location: london, , United Kingdom.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default PHP.ini and session.save_path variable

I am running Apache/2.0.52(Win32)PHP/4.3.9 on a Windows XP Machine with NO IIS installed.

I believe I have installed AMP successfully and have just successfully done the Try It Out - Passing the Visitors' Username Exercise on Page 52.

However I have spent 3 days trying to get it to work and I was just about to write to ask you what the problem was when - out of the blue- all of a sudden - it worked and I got the required result shown in fig 2-9.

However I do not know how - or more importantly where the session is being recorded. I believe I have a problem as I am not able to change the session.save_path variable in the php.ini file (which I have saved in the C:\windows directory) I have read somewhere that I might also have to save it in the C:\windows\system32 directory ??) but I have not done/tried that yet!!!!

When I was having difficulty getting the exercise to work I believed the problem was because I could not define the path in the session.save_path variable.

 I tried numerous times to set up various directories next to the session.save_path variable in the php.ini file - but no matter what directory I specified ( and which I duly shared) it was never recorded in the php.ini file when I ran the following test programme:
phpinfo ();

It always showed ‘no value set’ as shown in the table below!

The path setting is currently set to “/tmp” but I have no such folder on my C: drive!

Directive Local Value Master Value
session.auto_start Off Off
session.bug_compat_42 On On
session.bug_compat_warn On On
session.cache_expire 180 180
session.cache_limiter nocache nocache
session.cookie_domain no value no value
session.cookie_lifetime 0 0
session.cookie_path / /
session.cookie_secure Off Off
session.entropy_file no value no value
session.entropy_length 0 0
session.gc_divisor 100 100
session.gc_maxlifetime 1440 1440
session.gc_probability 1 1
session.referer_check no value no value
session.save_handler files files
session.save_path no value no value
session.serialize_handler Php php
session.use_cookies On On
session.use_only_cookies Off Off
session.use_trans_sid Off Off

Could you please explain why the exercise appears to be working - when there does not appear to be a folder “/tmp” set up for session data to be recorded and the variable is showing “no value” against it?

Also how do I go about setting the session.save_path to a directory of my choice?

Many Thanks.

Reply With Quote
  #2 (permalink)  
Old February 4th, 2005, 07:49 AM
Registered User
Join Date: Feb 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

My guess is that you are not editing the true php.ini file. When you run phpinfo() it will tell you the path to the ini file. Make sure this is the path you are using.

By default, php looks in the windows root directory for php.ini. This behavior can be changed (over-ridden) by registry entries and environmental path variables. It is also worth noting that php will run just fine if it can't find the php.ini file, it simply uses default values.

You've probably figured this out already but maybe this will help someone else.


Reply With Quote
  #3 (permalink)  
Old February 27th, 2005, 06:00 AM
Registered User
Join Date: Feb 2005
Location: , , Turkey.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts

I have the same problem. I edit the correct php.ini, under windows directory. The temp path is correct and session files are created (no error for cannot open/tmp etc) but unfortunately the session files are empty and contain no data. the variables I assign to session are not written to the file and therefore are not read by the moviesite.php . What is the problem?

Reply With Quote
  #4 (permalink)  
Old March 9th, 2005, 03:12 AM
Registered User
Join Date: Mar 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts


Please try the following.

In Apache2\conf (or your directory)edit httpd.conf file looking for AllowOverride, the default of this is none, change it to All.

The default is 'very restircitive", I am not sure of the security implications, perhaps someone more with a few more smarts can answer...anyway this is the full section that comes with Apache

# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
# First, we configure the "default" to be a very restrictive set of
# features.
<Directory />
    Options FollowSymLinks
    AllowOverride All

Hope it helps...

Reply With Quote

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
session error - php.ini file bogins Beginning PHP 8 January 5th, 2008 04:59 PM
Session Error / PHP.ini file socoolbrewster Beginning PHP 5 June 8th, 2006 04:18 AM
how to set session.save_path on WS 2003 ? cristi Pro PHP 2 April 2nd, 2005 04:45 PM
Constantly losing PHP session variable? achalasia PHP How-To 3 October 29th, 2004 09:08 AM
php.ini allang Beginning PHP 1 November 20th, 2003 09:09 PM

All times are GMT -4. The time now is 08:27 PM.

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