Wrox Programmer Forums
|
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 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 October 30th, 2005, 09:36 AM
Registered User
 
Join Date: Oct 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ch 2; php.ini set up; /tmp file (where is it?)

Hello,

I can't get passed ch2. The session_star() thing is not working. The session.set_path in the php.ini file which we Windows users need to change the path to, is set to /tmp, Now, where is it?. I've changed it to different paths to make sure it finds it but it doesn't. I've left it like it is and nothing. I've looked for the file but can't find it. There is a c:\Temp file in my directory. I've set it to this but nothing, so I changed it back to the default /tmp. Is it backslashes or forward slashes? I've tried both ways. Is there another setting that we need to change like the cookies path maybe? Or something else maybe. Oh, I've checked the php code on the movie1.php file and is fine. No spaces before at the top, no spelling error or typos, etc. I've even pasted the code from the book in the website just in case and nothing.
The only thing I can think of is the php.ini file and that it maybe has a wrong setting somewhere.
The page displays the following error(s):

Warning: session_start(): open(/tmp\(why the back and forward slashes here???)sess_4891c32dd5cf0ecfa5a329a743bfab01, O_RDWR) failed: No such file or directory (2) in C:\Program Files\Apache Group\Apache2\test\movie1.php on line 2

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\test\movie1.php:2) in C:\Program Files\Apache Group\Apache2\test\movie1.php on line 2

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at C:\Program Files\Apache Group\Apache2\test\movie1.php:2) in C:\Program Files\Apache Group\Apache2\test\movie1.php on line 2
Click here to see information about my favorite movie!
Warning: Unknown(): open(/tmp\sess_4891c32dd5cf0ecfa5a329a743bfab01, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0

Anyways, ANY help would be greatly appreciated.

monster.
 
Old February 19th, 2006, 07:23 PM
Registered User
 
Join Date: Feb 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am sure you have moved on by now, but for anyone coming along later:

1. You have to create the directory "c:\tmp" with Windows Explorer by selecting your c drive, then, file, new, folder "tmp".

2. That being said, I did that and set the session.save_path = "c:\tmp", and it still did not work. I read the php manual on php.net and with php 5.1.2 (4.3 or later) you don't have to set the path (at least that is how I understand it)

3. I commented out the session.save_path thing and set session.auto_start = 1 and it worked. (Passing variables with sessions)

Now, I am unable to Pass variables with cookies. Here is my code for movie1.php:

<?php
setcookie('username', 'Joe', time()+60);
session_start();
$_SESSION['authuser'] = 1;
?>

<html>

Ideas anyone? Thanks in advance.

 
Old February 21st, 2006, 06:09 PM
Registered User
 
Join Date: Feb 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If you have the error "header already sent", it means you have some characters before the "session_start()" line.

Here is my script that worked:

Line 0
<?php
    session_start();
    $_SESSION['username'] = $_POST['user'];
    $_SESSION['userpass'] = $_POST['pass'];
    $_SESSION['authuser'] = 0;
.
.

Actually the authors mentioned it but AFTER the scripts.

I also had the infamous /tmp problem, I don't remember how I fixed it, I'll find out and I'll come back







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
php.ini problem jun99 PHP How-To 0 January 22nd, 2006 04:10 PM
How to set up php.ini for sessions club662 BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 2 June 28th, 2005 12:35 PM
php.ini allang Beginning PHP 1 November 20th, 2003 09:09 PM





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