PHP Question

software development

#1

I’ve just moved a web site to dreamhost that I was developing on a home apache web server. I’m having some issues with session_start() because I don’t have rights to write in /tmp. It looks like I can change my session.cookie_path in the php.ini file but I don’t have a php.ini file to modify. How do I go about making changes like that to php. Do I need to download and install my own copy of php so I can make those changes?

Thanks


#2

1 - You should have write permissions to /tmp. It’s a swap space anybody should be able to write to.

2 - cookie_path is the path stored in the cookie. It has nothing to do with local file system.

  • You can set the cookie_path using session_set_cookie_params()
  • You can set the save_path (which is the location on the file system sessions are stored) by using session_save_path().

I’d suggest you give a good read about session handling in PHP. There seems to be a few things you’re missing:
http://us2.php.net/manual/en/ref.session.php


#3

Here is the message i’m getting back when I try to open a session here on dreamhost that lead me to believe I didnt have write access in /tmp.

Warning: session_start(): open(/tmp/sess_385aad4612eed1507e1503c53fca9ef6, O_RDWR) failed: Permission denied (13) in /home/.catzilla/tower/towersdomain.com/reminder/index.php on line 2

All i’m doing is a session_start()

<?php session_start(); ?>

Those are my first 3 lines in my index.php. I’m new to shared hosting of web pages. I’ve alway had my own box to put my pages on. I’m trying to figure out the tricks to it.

Thanks for the help and the link on sessions. I’ll read it over.


#4

setting session_save_path() to a tmp directory I created in my own home directory fixed my errors. Not sure why I’m not able to write in /tmp but I did submit an email to support this morning and I’ll see what they have to say.

Thanks again


#5

[quote]setting session_save_path() to a tmp directory I created in my own home directory fixed my errors. Not sure why I’m not able to write in /tmp but I did submit an email to support this morning and I’ll see what they have to say.
[/quote]
yeah, it would seem that there’s somethign wrong with your box. /tmp has to be globally writeable by everybody. If it’s not, they have something bugged. But glad you were able to get around it. Cheers


#6

Support got back to me. It turned out that /tmp wasnt set to world writable. They corrected it and everything works as it should.