11

I've updated Phpmyadmin from 4.4.1 version to 4.4.2 version and started to get this error:

Warning in ./libraries/session.inc.php#101 session_start(): open(/var/lib/php/session/sess_bsv20h8gq58qq1ep33qbfrb7r62jtksi, O_RDWR) failed: Permission denied (13)

Backtrace

./libraries/session.inc.php#101: session_start() ./libraries/common.inc.php#349: require(./libraries/session.inc.php) ./index.php#12: require_once(./libraries/common.inc.php)

This happened on two different machines with Centos 6.6 installed. The serber have Apache 2.2, PHP 5.4 and Nginx as reverse proxy.

6 Answers 6

40

In my case, I was running nginx primarily so needed to chown the sessions directory to nginx for user and group... (By default, the session folder was in the apache group).

chown nginx:nginx /var/lib/php/session

Then force refresh the phpMyAdmin page and the session permission related errors are resolved.

And if existing sessions, the contents too:-

chown -R nginx:nginx /var/lib/php/session    
0
16

I know that this is a very old question, but I resolve the problema just with this line:

chmod 777 to /var/lib/php/session

My server details, CentOS 6, provider vultr.com

4
  • 3
    Mode 777 is rarely the right choice because it defeats security considerations that the application and the system depend on.
    – Mogsdad
    May 6, 2016 at 22:01
  • 1
    chmod 770 /var/lib/php/session Works well. Jul 29, 2016 at 6:55
  • This saved my time.
    – midkin
    Jun 28, 2019 at 19:59
  • On Ubuntu: chmod -R 777 /var/lib/php/sessions.
    – Kamil
    Apr 27 at 9:41
4

Phpmyadmin provide config for this case.

  1. open config.inc.php file
  2. add the phpmyadmin session directory config

$cfg['SessionSavePath'] = '/tmp';

phpmyadmin/doc/config.rst

config:option:: $cfg['SessionSavePath']
:type: string
:default: ``''``

Path for storing session data (`session\_save\_path PHP parameter
<https://secure.php.net/session_save_path>`_).

warning::

This folder should not be publicly accessible through the webserver,
otherwise you risk leaking private data from your session. 
0

I recently had same issue on phpMyAdmin 4.4.3 cased by SELinux.

First of all check if you fit to server requirements http://docs.phpmyadmin.net/en/latest/require.html

Second, allow SELinux use PHP session:

grep php /var/log/audit/audit.log | audit2allow -M mypol
semodule -i mypol.pp

and change PHP session.save_path permissions to root:root:

chown -R root:root /var/lib/php/session
chown -R root:root /var/lib/php/wsdlcache
0

Be sure to check your php.ini file, specifically the "session" section.

; The file storage module creates files using mode 600 by default.
; You can change that by using
;
;     session.save_path = "N;MODE;/path"
;
; where MODE is the octal representation of the mode. Note that this
; does not overwrite the process's umask.
; http://php.net/session.save-path
session.save_path = "/var/lib/php/sessions"

If your using memcache you would probably have something like the following:

session.save_path = '127.0.0.1:11211'

By default it should look be a line like the following:

session.save_path = "/var/lib/php/sessions"

When copying a php.ini config from one server to another I ran into this issue where the other server was not using memcache for sessions.

enter image description here

0

Similar to the solution postged by zigojacko, for PHP 7.1 I needed the following command:

chown nginx:nginx /var/lib/php/7.1/session

On Amazon Linux EC2 instance running Nginx.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.