Warning: session_start(): open(/var/lib/php/session error - php

I am currently using Opencart 1.5.5.1 shopping cart software and have recently encountered an error. My sites frontpage has gone completely down and when I attempt to login via the admin side of the store I receive the following error:
Warning: session_start(): open(/var/lib/php/session/sess_gbatrqu15lf22fbb0cprgjlrs5, O_RDWR) failed: Permission denied (13) in /var/www/vhosts/andysmotorcycles.com/httpdocs/system/library/session.php on line 11
I have checked line 11 and it is simply the session_start() command.

It seems as though that you have used up all your inodes on your hosting plan (1 inode = 1 file) Most Hosting services limit the number of files that can be generated on the server (this includes everything (emails, source files, session files ...)) You most likely need to remove old session files from the var/lib/php/session dir. Once you do that, yur inodes usage will be uch and lower and your issue will be resolved. Try to use a cron to automatically scan the dir at a preset schedule and remove old session files

Related

Azure - "PHP Warning: session_start(): Cannot find save handler 'wincache'" after already being loaded

I've got a webjob running on my Azure app service that starts off with the session_start(); command.
At first - I was getting this error:
PHP Warning: session_start(): Cannot find save handler 'wincache' -
session startup failed in
D:\local\Temp\jobs\triggered\myCron\a4ypumbv.4i2\MyCron\myCron.php on
line 3
What I ended up doing was going to my App Service -> Application Settings, and I set a custom setting of PHP_INI_SCAN_DIR set to D:\home\site, like so:
Then, inside the D:\home\site directory, I uploaded a file titled phpconfig.ini, and inside I placed this:
extension=D:\home\site\ext\php_wincache.dll
I went to https://www.iis.net/downloads/microsoft/wincache-extension and downloaded the appropriate WinCache version - WinCache 1.3 for PHP 5.6 from SourceForge. After unpacking the .exe file, I copied the php_wincache.dll file into my D:\home\site\ext folder.
Now, when I run the webjob, I get this same error but also another error message right before it saying the wincache file was already loaded:
PHP Warning: Module 'wincache' already loaded in Unknown on line 0
PHP Warning: session_start(): Cannot find save handler 'wincache' -
session startup failed in
D:\local\Temp\jobs\triggered\myCron\a4ypumbv.4i2\MyCron\myCron.php on
line 3
How can I make these warnings go away completely? Has anyone run into the same problem before?
wincache has been already installed and enabled in Azure App Service.
In this case, you no longer need to call session_start() manually, Azure would start sessions on each page automatically.

PHP Session issue only on GoDaddy (Warning: session_start(): Cannot send session cookie)

I am currently working on a user registration system for a client on GoDaddy hosting.
I have previously never had this sort of issue before on Hostgator and while testing locally on a PHP test server on OS X.
It's a fairly simple script too. common.php accesses the MySQL database, all of the pages (login, register, etc.) include common.php. Sessions start when the user logs in, etc.
I see the following errors at the top of the page:
Warning: session_start(): open(/home/content/10/12114910/tmp/sess_trmok9fgtb527mjp21a76shf54, O_RDWR) failed: No such file or directory (2) in /home/content/10/12114910/html/common.php on line 86
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/content/10/12114910/html/common.php:86) in /home/content/10/12114910/html/common.php on line 86
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/content/10/12114910/html/common.php:86) in /home/content/10/12114910/html/common.php on line 86
The following errors are at the bottom of the page.
Warning: Unknown: open(/home/content/10/12114910/tmp/sess_trmok9fgtb527mjp21a76shf54, O_RDWR) failed: No such file or directory (2) 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 () in Unknown on line 0
Once again, this is only a GoDaddy issue. My client was originally on Windows hosting and this just did not even work at all and I switched them to Linux hosting.
They were on PHP version 5.3 and I changed it to 5.4 and I have still had no luck.
I have never messed with a php.ini file. Would I need to create one? I have heard that uploading it into the public_html folder overrides the one on the server even though we are on a shared hosting plan.
Would I also need SSH access to create a tmp folder and set proper permissions for it?
This is usually quite easy to fix on crappy providers (I don't recommend GoDaddy, by the way).
Here is how I'd go about fixing it, hopefully it will help you.
Step 1: Make a directory and call it _sessions or something of that
nature.
Step 2: Give it a chmod of 775 so that the web server can write to it.
Step 3: On the first script that runs, right at the top place session_save_path("./_sessions");
Step 4 (optional, but recommended): Add either deny from all in a .htaccess file to prevent people from getting to the directory, or simply chmod 776.
Find out more about session_save_path() here: php.net/session_save_path

Sessions limited on server?

2011-12-08 17:24:04 - PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0
2011-12-08 17:24:04 - PHP Warning: Unknown: write failed: No space left on device (28) in Unknown on line 0
Getting these errors after uploading a certain amount of content. Also, noticed that can no longer log in to admin panel. Could this be cause by too many sessions be stored on a server? Or anyone have any other ideas? First happened after uploading a few images through admin panel in open cart.
I am hosting a bunch of sites off of one server. SO it seems likely but has anyone run into this before?
Looks very likely that you've run out of space on the disk and so causing many things to fail. Try freeing up some space and try again.

Error on the site - session_start() [<a href='function.session-start'>

My site was working fine, but suddently today i saw the site down and no one page is showing up. I found the error in database table "error_logs" that is -
session_start() [<a href='function.session-start'>function.session-start</a>]: open(/tmp/sess_8ef98c4df344123c0cb28dc727e70664, O_RDWR) failed: Read-only file system (30)
I can't understand this issue and how to solve it.
A read-only file system usually indicates that your hard drive has failed. Do you have any kind of access to your server? (e.g. FTP, SSH)
To verify this if you have SSH (and root) access, try creating a file, and checking the logs for error messages:
touch /tmp/test.txt
dmesg | tail
If you have FTP/SFTP access, try uploading a file and seeing if it works.

PHP: Session_start() directory does not exist error

I have looked around on the issue - but it seems that all I can find about it is people who are having the problem connecting to a local database or something (not really sure). I am having the problem on my website (any time I make an ajax call to a file that has a session_start())
Anyways, this is the error message I am getting:
Warning: session_start() [function.session-start]: open(/usr/local/apache/bin/httpd/sess_5840483107c1db9753c32214723b64a6, O_RDWR) failed: Not a directory (20) in /data/in/r/reiconsultants/www/employee/user_page_login.php on line 3
Warning: Unknown(): open(/usr/local/apache/bin/httpd/sess_5840483107c1db9753c32214723b64a6, O_RDWR) failed: Not a directory (20) 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 (/usr/local/apache/bin/httpd) in Unknown on line 0
I haven't touched the code in a while - and I can be quite sure that no one else has either, so I am not sure why the error is occurring. I read a bunch about people going in and setting the php.ini file, but I have never had to do that before - and can't even find the file.
Like I said - the error is occurring on my company website, not when trying to connect to a local database.
The error just popped up today - I got flooded with emails about it, and it is on more than one web page being hosted on the server - all the pages I have that include a session_start() at the top have the issue.
Could it be a server side issue that I can't fix? or what...
sorry if I am not descriptive enough - I have absolutely no idea what is going on, and therefore don't know what to say. Just ask me for any clarification you need.
Thanks!
Paul
The error is indicating that /usr/local/apache/bin/httpd/ is set as your folder to save session data in. Does that folder exist and is writable by the user Apache is running as? Does the Linux server have any other security measures like SELinux running that might be stopping writing to that directory?
Did you verify that the current setting of session.save_path is correct? Is /usr/local/apache/bin/httpd correct folder for saving session data?
Try set session.save_path = "/tmp" in you php.ini to ensure that problem is in folder.
you can also change the session path at run time:
string session_save_path([string $path])

Categories