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

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.

Related

Prestashop installation on server giving Internal server error 500

Having the same problem while installing the latest Prestashop on my server. So as #Agnes Tom has recommended, I changed the define.inc.php file and this is the error it´s showing up:
Warning: session_start(): open(/var/php_sessions/sess_b3c24487f16e9dcc7ebe9b0897bee69f, O_RDWR) failed: No such file or directory (2)
in /hermes/bosnaweb14a/b1900/ipw.danarostocom/public_html/zumashoes/install/classes/session.php on line 47 Notice: Use of undefined constant _NEW_COOKIE_KEY_ - assumed '_NEW_COOKIE_KEY_'
in /hermes/bosnaweb14a/b1900/ipw.danarostocom/public_html/zumashoes/classes/Cookie.php on line 79 Fatal error: Uncaught exception 'Defuse\Crypto\Exception\BadFormatException' with message 'Encoding::hexToBin() input is not a hex string.'
in /hermes/bosnaweb14a/b1900/ipw.danarostocom/public_html/zumashoes/vendor/defuse/php-encryption/src/Encoding.php:65 Stack trace:
#0 /hermes/bosnaweb14a/b1900/ipw.danarostocom/public_html/zumashoes/vendor/defuse/php-encryption/src/Encoding.php(164): Defuse\Crypto\Encoding::hexToBin('_NEW_COOKIE_KEY...')
#1 /hermes/bosnaweb14a/b1900/ipw.danarostocom/public_html/zumashoes/vendor/defuse/php-encryption/src/Key.php(38): Defuse\Crypto\Encoding::loadBytesFromChecksummedAsciiSafeString('\xDE\xF0\x00\x00', '_NEW_COOKIE_KEY...')
#2 /hermes/bosnaweb14a/b1900/ipw.danarostocom/public_html/zumashoes/classes/PhpEncryptionEngine.php(112): Defuse\Crypto\Key::loadFromAsciiSafeString('_NEW_COOKIE_KEY...')
#3 /hermes/bosnaweb14a/b1900/ipw.danarostocom/public_html/zumashoes/classes/PhpEncryptionEngine.php(46): PhpEncryptionEngineCore::loadFromAsciiSafeString('_NEW_COOKIE_KEY...')
#4 /hermes/bosnaweb14a/b1 in /hermes/bosnaweb14a/b1900/ipw.danarostocom/public_html/zumashoes/vendor/defuse/php-encryption/src/Encoding.php on line 65
Warning: Unknown: open(/var/php_sessions/sess_b3c24487f16e9dcc7ebe9b0897bee69f, 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 (/var/php_sessions) in Unknown on line 0
Might anyone helping me to know how to solve this error??
Thank you for your time
It's throwing an error saying it can't find or write to '/var/php_sessions/'
Do you have full access to the server?
If so, check if that folder exists and if the user or web server has permission to write to it, or change in php.ini
session.save_path = "/var/php_sessions"
To something like :
session.save_path = "/home/user/sessions"
Again, must be an existing folder with read/write permissions for the user or web server (this depends if you run the web server as own user or as account user).
If it's a shared envoirement, you better contact you hosting provider. Some allow you to have a php.ini in your hosting root and you could use it to change the session.save_path, others ignore it.
How to recognize the Error 500
First, we need to go over the different ways you might see this error message on your computer. There are different forms of this message because each host/server is allowed to customize the way it’s displayed. Here are some common ways you might see this error.
“500 Internal Server Error”
“HTTP 500 – Internal Server Error”
“Internal Server Error”
“HTTP 500 Internal Error”
“500 Error”
“HTTP Error 500″
Most times you will see this message accompanied by various forms of this classic ambiguous line
“The server encountered an unexpected condition that prevented it from fulfilling the request by the client”
It’s important to note that this error can be shown on any browser and any operating system (sorry, but switching to the new Mac Pro will not solve this problem) Here is a screenshot of one of the ways this error might be displayed on your browser.
Internal error server
What is the 500 Error?
Put simply, the 500 error is the Web servers way of saying “Something went wrong but I can’t tell you what, sorry.” This is what we call a “server-side” error. That means that there is something wrong with the server who is hosting the website. It is an extremely general error usually caused by configuration issues with the websites programming, PHP or system permissions.
How Can I Troubleshoot?
Don’t fret; although this error message is absurdly vague, you still have ways to find more information. Web servers are almost always configured to hide specific error messages. If your PrestaShop store is suffering from this debilitating error, you can turn on PrestaShop’s Error Reporting from FTP or your hosting’s CPanel to get more details.
There are two ways to turn on Error Reporting in PrestaShop depending on what version you have.
For PrestaShop v1.4 through v1.5.2
Open config/config.inc.php
On or around line 29 you will find this line
#ini_set('display_errors', 'off');
Change that line to read
#ini_set('display_errors', 'on');
For PrestaShop v1.5.3+
Open config/defines.inc.php
On or around line 28 you will find this line
define('_PS_MODE_DEV_', false);
Change that line to read
define('_PS_MODE_DEV_', true);
Once you enable error reporting through your FTP or CPanel, you can navigate back to your PrestaShop’s front or back office and reproduce the error or issue you are having. For example, if you are not able to access your website because of the 500 error, you will need to turn on error reporting and refresh the page(s) that had the error. There will be additional information that you can use to investigate the problem.
Investigating the Error
Once you have the additional information, there are some standard ways to further investigate the error. First, let’s go over some the most common ways this problem is caused. Once we find the cause of this error, it is much easier to solve.
Permissions: Many times you will find that the permission setting on one of your folders is set incorrectly. It could be a simple fix as switching a file/folder permission from 777 to 755 or vice versa. In most cases permission sets of 777 are extremely unsafe and can allow even an amateur hacker to access your files and put malicious code in it. Make sure to check with your hosting provider for specific information about permissions set as some servers have different regulations.
Incorrectly configured .htaccess: Oftentimes you will receive an internal server error when the htaccess file is configured incorrectly. For PrestaShop purposes, the main culprits of the htaccess errors are “URL Rewrite” settings or Friendly URL enabling. The htaccess syntax is very strict so even one wrong character or command will cause the server to return an Internal Error 500. Make a backup of your htaccess and regenerate the htaccess file either through the back office or by toggling the Enable Friendly URL option.
Server timeout: Every server has their own timeout setting, which sets the time that any given script can run. If the function or script crosses that limit, you will receive an error 500. The most common scripts in PrestaShop that can take too long to load are CSV Imports, backups, translation loading, import/exports and thumbnail regeneration. Many times the server limit is 30 seconds, which is not long enough to run these scripts. You should contact your hosting provider and inquire about changing the limit, at least temporarily.
Now, if the problem is not solved by investigating these common causes, you should also take a look at the Apache and PHP Error logs. These are provided by your hosting provider but sometimes you will need to contact them directly in order to have access to these log files.

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

PHP ftp_get causing warning and not downloading file

I've got a fairly simple cron job that pulls down some files from an FTP server - none of the files are particularly large, but I'm constantly getting the following:
Connected to voip.colefabrics.com, for user colefabrics\absolute
Warning: ftp_get(): Opening BINARY mode data connection. in /home/www/colefabrics.com/httpdocs/libs/classes/class.ftpObj.php on line 56
There was a problem while downloading website/items.csv
Attempt 2:
Connected to voip.colefabrics.com, for user colefabrics\absolute
Warning: ftp_get(): Opening BINARY mode data connection. in /home/www/colefabrics.com/httpdocs/libs/classes/class.ftpObj.php on line 56
There was a problem while downloading website/items.csv
...snip...
I've been through all the other posts relating to this, tried to enforce passive mode, increased the timeout, but nothing is working.
Does anyone know what might be causing this, and what I can do to try and resolve it?
To confirm, it's working fine via a 'normal' FTP client, it's only via PHP that I have a problem.

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

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

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