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 9/08/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
  3. 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;
    		
    	
  4. 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 need any help with web development don't hesitate to contact our web development agency. We run the best custom web development agency in Montreal.

Sidick Allaladé

Sidick Allalade, is Chief Technology Officer at Oshara INC and co-founder of the Osortoo web application. He loves solving complex IT problems, coding and everything IT. He has a good knowledge of online marketing and IT Governance, Audit and Security.
His experience spans hundreds of projects with companies of all sizes which makes him a valuable asset on any team.

Was this article useful?

People Who Read This Article Also Read...

Everything You Need To Know About Communication Agencies

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

Everything You Need To Know Ab...


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...


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...


This is How you can Simplify Complex Enterprise Workflows in Your Business

A workflow is a repeatable scheme or pattern of a sequence of steps or activities that are undertaken to realize the completion of a pa...

This is How you can Simplify C...


How to obtain instagram certification?

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

How to obtain instagram certif...


×