Error failed: No space left on device

4

When reinstalling the Apache and PHP server on my machine I'm getting this error:

  

Warning: Unknown (): write failed: No space left on device (28) in Unknown on line 0

And if I try to run some script with session, besides this error, I get the following error:

  

Warning: Unknown (): Failed to write session data (files).   Please confirm that the current setting of session.save_path is correct (/ tmp) in Unknown on line 0

    
asked by anonymous 19.02.2015 / 00:49

1 answer

4

This problem usually occurs for reasons such as:

  • The configured directory (in the /tmp case) is not writable.
  • The directory does not allow access from the current user (the server can have root user access, but the directory only has root access).
  • This may be a directory that does not exist.

The /tmp directory is just an example, see another problem situation:

  

Warning: Unknown: Failed to write session data (files). Please confirm that the current setting of session.save_path is correct (/ opt / lampp / tmp / session) in Unknown on line 0

In this case the lampp server was installed on a like-unix machine and the /opt/lampp/tmp/session folder is probably not accessible (for one of the reasons already described).

In the case of the problem you are also likely to return this error:

  

Warning: Unknown (): Failed to write session data (files).

Possible solutions:

  • If the directory does not exist we should edit the php.ini file and configure it to a valid directory: Look in the php.ini file for this line and change it:

    session.save_path = /home/user/tmp;
    

    If it's a Windows server / machine it would look something like:

    session.save_path = c:/wamp/tmp;
    
  • If you have made the php.ini modification and even then the problem occurs, you may be in a "virtual server", so change has to be on that server .

  • If you are sure that you are not a virtual server or have changed the right file, then that is why you need to restart the server (you do not need to restart the entire machine):

    If it is Apache, in the terminal use the command:

    apache2 restart or with SU use sudo apache2 restart

  • If you have restarted (even the machine), the problem may be in the permissions of the folder. To change the permissions, use the following command:

    chmod 1777 /tmp

  •   

    Note: On like-unix systems it is not necessary to allow access to the folder that will be the session for all user (operating system user), only the user that the service is running.

    Another solution is to configure using (in case the problem is with session_start ) session_save_path :

    session_save_path('/home/user/tmp');
    

    Now if for some reason you are using a hosting service and you do not have access to php.ini and the session_save_path is disabled there is only one solution, look for the technical support of the company that you are providing the service via ticket , phone or email (in some cases chat).

        
    19.02.2015 / 00:49