Failed to write session data (files).
« on: July 30, 2008, 06:52:33 AM »
Hi Oleg,

How can I avoid the PHP warnings below please?

- - - - - - - - - - - - - -
The generator is running the default settings which relate to the session handling.

ecom@brd:~> grep -i sess ~/www/sitemapgenerator/config.inc.php
'xs_cleanpar' => 'PHPSESSID|sid|osCsid',

- - - - - - - - - - - - - -
We use memcached for storing our php session data:

ecom@brd:~> grep session.save_path /etc/php5/apache2/php.ini
session.save_path = "tcp://192.168.0.117:11211"

- - - - - - - - - - - - - -
The problem is the bottom of this.

ecom@brd:~> /usr/bin/php5 /home/ecom/www/sitemapgenerator/runcrawl.php     
<html>
<head>
<title>XML Sitemaps - Generation</title>
<meta http-equiv="Content-type" content="text/html;charset=iso-8859-15" />
<link rel=stylesheet type="text/css" href="pages/style.css">
</head>
<body>
Resuming the last session (last updated: 1970-01-01 10:00:00)1 | 9 | 50.6 | 0:02 | 0:23 | 1 | 567.1 Kb | 1 | 0 | 567
20 | 27 | 291.0 | 0:08 | 0:11 | 3 | 483.5 Kb | 20 | 14 | -84
40 | 7 | 661.9 | 0:18 | 0:03 | 3 | 526.7 Kb | 40 | 37 | 43
47 | 0 | 754.5 | 0:19 | 0:00 | 4 | 511.1 Kb | 47 | 0 | -15
<h4>Completed</h4>Total pages indexed: 47<br>Creating HTML sitemap...<script>
top.location = 'index.php?op=view'
</script>
PHP Warning:  Unknown: open(/var/lib/php5/sess_k6kuuqeqe2ao7qctr6udi1nqt0, O_RDWR) failed: Permission denied (13) in Unknown on line 0
PHP Warning:  Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php5) in Unknown on line 0
- - - - - - - - - - - - - -

Thx
Stew


.

Re: Failed to write session data (files).
« Reply #1 on: July 30, 2008, 03:29:54 PM »
Hello,

this is a PHP configuration issue, you should have write permissions allowed for /var/lib/php5/ on your server to allow storing sessions information.
However, this is only a warning message and this is not related to sitemap generation itself and it should still work fine.
Re: Failed to write session data (files).
« Reply #2 on: July 31, 2008, 03:24:24 AM »
Hi Oleg,

Thank you - yes it was a permissions issue on the directory for storing php session files.
Here's some more info which may benefit others.

When running php from the command line (as cron jobs do), the php configuration comes from a different php.ini file as it does when php runs from the web, ie under apache control.   To remedy the php warnings I had to set the session.save_path (to a writable directory) in the CLI php.ini not in the web php.ini file.

And as you say - it is only a warning not an error - so no real harm done.
However as I'm running the command line as a cron job, errors and warnings sent to stderr which cron emails  to the mailto: specified in the crontab file.  By eliminating this warning I'm avoiding more pesky emails in my inbox.

Thanks again for your fast response.
Stew
« Last Edit: July 31, 2008, 03:28:20 AM by stewart.howell »