Greetings. I'm hoping I can get a bit of assistance. I'm working through the Beginning PHP/MySQl book, and I believe I've hit a snag in Chapter 2.
When I try to run the following code, I get the following errors.
I'm not on my own server (haven't set up MySQL or PHP yet), but instead I'm using a hosting service (Linux server). As a result, I can't check the session.save_path in the php config file.
PHP works on the hosts server as I can look at a phpinfo.php file and other scripts work including the previous scripts in the book.
Code:
<?php
session_start();
$_SESSION['username']="Joe12345";
$_SESSION['authuser']=1;
?>
<HTML>
<HEAD>
<TITLE>Find my Favorite Movie!</TITLE>
</HEAD>
<BODY>
<?php
$myfavmovie=urlencode("Life of Brian");
echo "<a href='http://localhost/moviesite.php?favmovie=$myfavmovie'>";
echo "Click here to see information about my favorite movie!";
echo "</a>";
?>
</BODY>
</HTML>
gives the following errors:
Code:
Warning: session_start(): open(/hsphere/local/home/rela/tmp/sess_e395dfaad86a77504fa936fd93b40aa9, O_RDWR) failed: Permission denied (13) in /home/hsphere/local/home/rela/domain.com/book/movie1.php on line 2
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/hsphere/local/home/rela/domain.com/book/movie1.php:2) in /home/hsphere/local/home/rela/domain.com/book/movie1.php on line 2
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/hsphere/local/home/rela/domain.com/book/movie1.php:2) in /home/hsphere/local/home/rela/domain.com/book/movie1.php on line 2
Click here to see information about my favorite movie!
Warning: Unknown(): open(/hsphere/local/home/rela/tmp/sess_e395dfaad86a77504fa936fd93b40aa9, O_RDWR) failed: Permission denied (13) 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 (/hsphere/local/home/rela/tmp) in Unknown on line 0
I replaced my domain above with "domain.com" but it actually had my domain name.
It's the permission denied part that has me worried. Do I need to have my hosting service change permissions for the /tmp directory? And if so, what should the permissions be?
Many thanks,
SC