How to fix Joomla Error 0 'Cannot open file for writing log while updating'?

How to fix Joomla Error 0 'Cannot open file for writing log while updating'?

by Sidick Allaladé on 17/01/2020 |

Updated at 22/02/2020


Did you already try udpating your joomla website and you got this error :

"An error has occurred. 0 Cannot open file for writing log"

Don't worry, you're not alone, this may be due to different reasons, here are couple of them and solutions to fix each of them.

If you have issue with updating backend you won't probably be able to to it, so open the file "configuration.php" and find path of tmp or log folders and replace with correct path.

Here is an exemple of a path to Log and tmp Folder :

	
		*/home/**yourusername**/public_html/logs*
		or
		*/home/**yourusername**/public_html/administrator/logs*
		
		*/home/**yourusername**/public_html/tmp*
	
  1. Permission issue

    Make sure all files and folders apart from the global configuration.php are writable. If they aren't, then you will need to change the permissions, so that all folders are set to 755 and files are set to 644.
    To check permissionn in the Joomla backend, go to:

    System (top menu) >> System Information >> Directory Permissions

    You can either do this using an FTP client such as FileZilla, SSH or a Joomla extension such as Admin Tools .

    I usually use SSH and here are the normal permissions of any joomla website, Remember to go in the project folder before running these 2 commands.

    	
    		find -type d -exec chmod 755 {} \;
    		find -type f -exec chmod 644 {} \;
    
    	

    Admin Tools extensions is really helpfull for this is you are not familiar with SSH, but even if you are, Admin Toools for joomla is a good option to add protection on your joomla or wordpress website.

    Do not set the permission to 777 !

  2. Wrong directory paths for the tmp/log directories, defined in the configuration file

    You must configure your "/log" and or "/tmp" folder to a absolute links of your server, in the backend of joomla.
    To check/change the path, in Joomla backend, go to Global Configuration and then choose the Server tab and check if the Path to Log folder is correct

    • log : $log_path
    • tmp : $tmp_path

    If you are not sure what is your path is create a .php file and paste this code to know what is the absolute path to your server. Upload and call it on your browser: ex: www.domain.com/path.php, here is the code

    	
    		
    		   $path = getcwd();
    		   echo "Your Absolute Path is:" . $path;
    		
    	
    
  3. Directories and file ownership

    Check the ownership of the folder it can be set to root:root and this can be set from your /var/www/html folder.

    Problem arises if you want to write something to files within your website (change existing files or upload new files) . Root privileges would not allow you to do so.

    To fix it you need to set ownership to www-data:www-data or apache:apache.

    You need to pay attention to make sure that you set www-data or apache permissions only to directories (files) that you need to change from website.

    Setting it to /var/www/html or even /var/www is not recommended as it is big security hole.

     

If you solve this issue another way, please feel free to comment bellow.

Was this article useful?

People Who Read This Article Also Read...

A communication agency everything you need to know

By definition, a communication agency (marketing) is a company that plans and harmonizes internal and / or external communication on be...

A communication agency everyth...


Develop a Native, Hybrid or Web application? What are the differences?

There are different types of applications (apps), each with their own advantages and disadvantages. We will try here to lighten your sh...

Develop a Native, Hybrid or We...


Is ETL Still Relevant in 2019?

ETL is an abbreviation for extract, transform, and load. It is one of data integration tools used in the extraction of data from a sour...

Is ETL Still Relevant in 2019?


How Netlinking Is Useful for Your SEO

With the aim of helping companies improve their notoriety through their blogs. Oshara Inc, shares his knowledge about Netlinking in thi...

How Netlinking Is Useful for Y...


How to obtain instagram certification?

Like Twitter and Facebook, Instagram offers the possibility for administrators of an Instagram page to certify certain pages. Oshara I...

How to obtain instagram certif...


Good or bad idea invest in a good visual identity

Complicated to find something more important than visual identity in business communication. The visual identity of a company is the fi...

Good or bad idea invest in a g...


×
Processing.....