PHP Warning - Failed to write session data - Joomla! 3.7.2

Need help installing Joomla! 3.x? For all Joomla! 3.x installation issues please use this forum. Note: Users creating new sites can use either version 2.5 or 3.x. Please consider the availability of third-party templates and extensions when deciding which Joomla version to use.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
hexnext
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Mon Dec 11, 2017 6:46 pm

PHP Warning - Failed to write session data - Joomla! 3.7.2

Postby hexnext » Mon Dec 11, 2017 8:07 pm

Dear users,

I am building a Joomla! website with a lot of code customization to my components. I also had to change a lot of strings to the translations files and now it's time to upgrade the Joomla and the components core, for which I need to set up a local development environment.

I decided to use VirtualBox to run a copy of my Joomla! 3.7.2 website on Ubuntu 16.04 with Apache 2.4.18, PHP 7, MySQL 5.7. I could recycle a previous DE where I was testing Drupal so I don't exclude a compatibility issue.

Summing up my migration procedure for you:
  • I exported a database dump from the live site web hosting server and downloaded a whole copy of Joomla core, then placed all its content in /var/www/html.
  • Created a new database and imported the db dump through Phpmyadmin
  • I edited configuration.php so that it would match the new local server
  • Made sure PHP session folder was writable and owned by the user under which Apache is running

When browsing the HTTP content of my server I get the notorious message

Code: Select all

Error displaying the error page

and the Apache itself error logs read

Code: Select all

PHP Warning:  session_write_close(): Failed to write session data (user). Please verify that the current setting of session.save_path is correct (/tmp) in /var/www/html/libraries/joomla/session/handler/native.php on line 194


Then I tinkered native.php boolean values as I read around the internet, disabled session management as a whole via configuration.php and a few more things but anytime I load any PHP file from Joomla's core I get the aforementioned error. Other PHP scripts work fine so I'm asking for some input from you as to what may be causing this issue.
Last edited by imanickam on Tue Dec 12, 2017 6:39 am, edited 1 time in total.
Reason: Moved the topic from the Italian Forum to the [English] forum Installation - Joomla! 3.x

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 23938
Joined: Mon Oct 27, 2008 9:27 pm
Location: Akershus, Norway

Re: PHP Warning - Failed to write session data - Joomla! 3.7.2

Postby Per Yngve Berg » Mon Dec 11, 2017 9:08 pm

Mod. Note: Why have you posted this in the Italian and not the English Forum?

You must set session.save_path to a writeable folder on the server.

hexnext
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Mon Dec 11, 2017 6:46 pm

Re: PHP Warning - Failed to write session data - Joomla! 3.7.2

Postby hexnext » Tue Dec 12, 2017 12:32 pm

Sorry about the misplacement of this thread, you can move it to the English forum.

In my php.ini I set

Code: Select all

 session.save_path = "/tmp"


I'm sure it's writable. Using the following command

Code: Select all

ls -l /
in a terminal returns

Code: Select all

drwxrwxrwt   8 root root  4096 Dec 12 13:24 tmp

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 33958
Joined: Sat Apr 05, 2008 9:58 pm

Re: PHP Warning - Failed to write session data - Joomla! 3.7.2

Postby Webdongle » Tue Dec 12, 2017 1:10 pm

viewtopic.php?f=621&t=582860 please

Code: Select all

session.save_path = "/tmp"
server /tmp or absolute/path/to/joomla/tmp

hexnext
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Mon Dec 11, 2017 6:46 pm

Re: PHP Warning - Failed to write session data - Joomla! 3.7.2

Postby hexnext » Wed Dec 13, 2017 11:17 pm

Thanks a lot for referring to your script, it helped me figure out my problem in the connection to the database and other issues with files ownership. I also found this page https://stackoverflow.com/questions/5246114/php-mkdir-permission-denied-problem#21685655 useful in fixing it.

Very good script

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 33958
Joined: Sat Apr 05, 2008 9:58 pm

Re: PHP Warning - Failed to write session data - Joomla! 3.7.2

Postby Webdongle » Wed Dec 13, 2017 11:50 pm

It's not my script

btw the link you posted is about Ubuntu ... you may be interested in https://docs.joomla.org/Installing_Joom ... _Joomla.21 . Using Xampp and it's ftp server to create the folders (and transfer files) negates the need to chown them !!!

chrisvarco
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Wed Nov 22, 2017 8:22 am

Re: PHP Warning - Failed to write session data - Joomla! 3.7.2

Postby chrisvarco » Sat Dec 16, 2017 3:40 pm

Thanks for the input, however this seems very involved to install Joomla
Does anyone know of alternatives to install aside from this default method.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 33958
Joined: Sat Apr 05, 2008 9:58 pm

Re: PHP Warning - Failed to write session data - Joomla! 3.7.2

Postby Webdongle » Sat Dec 16, 2017 4:10 pm

@chrisvarco

Manipulating files on a Ubuntu OS on a home computer is slightly different to manipulating files on a Windows PC. So localhost on a Ubuntu OS on a home computer is slightly different to localhost on a Windows PC.

storm77
I've been banned!
Posts: 15
Joined: Mon Dec 18, 2017 4:21 pm
Contact:

Re: PHP Warning - Failed to write session data - Joomla! 3.7.2

Postby storm77 » Mon Dec 18, 2017 6:19 pm

looks like you need to change file permissions. Try 777

User avatar
sozzled
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4300
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia
Contact:

Re: PHP Warning - Failed to write session data - Joomla! 3.7.2

Postby sozzled » Mon Dec 18, 2017 7:36 pm

I doubt that @storm77 will be posting to this forum in future but, even so, no-one ever recommends setting folder/file permissions to 777. This folklore has been debunked countless times; it's not even useful as a workaround. Setting permissions to 777 simply allows anyone (including hackers) to gain access to your web assets and you can say goodbye to all your hard work.

J! 3.7.2 is old; it's out of date and unsupported. If you're building a new website then please don't use a version of Joomla that was released nearly seven months ago. It takes 10 minutes to create a new website with the standard installation of Joomla. If it takes seven months to construct it then there's something very wrong.

The most reliable approach is to use a properly/professionally setup webhosting platform; if people can't build this setup themselves there are [literally] thousands of cost-effective places where they can obtain those services.
https://www.kuneze.com/blog
Former member of Kunena project team
If you think I’m wrong then say “I think you're wrong.” If you say “You’re wrong!”, how do you know?


Return to “Installation Joomla! 3.x”

Who is online

Users browsing this forum: No registered users and 4 guests