We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Update Fails (Log file path not writable)

How Do I?

rdw's avatar
rdw
3 posts
5 years ago
rdw's avatar rdw

When running the One Click Update on a new installation of ExpressionEngine 5.2.3, the update fails with the following messages:

We stopped on Updating files. Log file path not writable: [Server path]\system/user/cache/ee_update

The following stack trace is provided:

#0 [Server path]\system\ee\updater\EllisLab\ExpressionEngine\Updater\Service\Updater\Runner.php(351): EllisLab\ExpressionEngine\Updater\Service\Logger\File->__construct(‘[Server path]…’, Object(EllisLab\ExpressionEngine\Updater\Library\Filesystem\Filesystem), false)
#1 [Server path]\system\ee\updater\EllisLab\ExpressionEngine\Updater\Service\Updater\Runner.php(37): EllisLab\ExpressionEngine\Updater\Service\Updater\Runner->makeLoggerService()
#2 [Server path]\system\ee\updater\EllisLab\ExpressionEngine\Updater\Controller\Updater\Updater.php(34): EllisLab\ExpressionEngine\Updater\Service\Updater\Runner->__construct()
#3 [Server path]\system\ee\updater\boot.php(94): EllisLab\ExpressionEngine\Updater\Controller\Updater\Updater->run()
#4 [Server path]\system\ee\updater\boot.php(65): routeRequest(‘updater’, ‘updater’, ‘run’)
#5 [Server path]\hq.php(143): require_once(‘[Server path]…’)
#6 {main}

The following log information is generated in the file \system\user\cache\ee_update\update:

[00:18:45 -0500] Maximum execution time: 0
[00:18:45 -0500] Memory limit: 256M
[00:18:45 -0500] Checking file permissions needed to complete the update
[00:18:45 -0500] Cleaning up upgrade working directory
[00:18:45 -0500] Old zip archives found, deleting
[00:18:45 -0500] Old extracted archives found, deleting
[00:18:46 -0500] Checking free disk space
[00:18:46 -0500] Free disk space (bytes): 38158372864
[00:18:47 -0500] Downloading update package
[00:18:55 -0500] Unzipping package
[00:19:03 -0500] Package unzipped
[00:19:03 -0500] Verifying integrity of unzipped package
[00:19:04 -0500] Package contents successfully verified
[00:19:04 -0500] Checking server requirements of new ExpressionEngine version
[00:19:04 -0500] Server requirements check passed with flying colors
[00:19:04 -0500] Moving the updater micro app into place
[00:19:04 -0500] Taking the site offline

ExpressionEngine is installed on a Windows 2016 Server with Apache 2.4, PHP 7 and MySQL 8. The system is installed and appears to be working normally except for this update error. This is a new installation, and I have not been able to previously run the updater to successfully.

I can confirm that ExpressionEngine is able to write to the \system\user\cache directory in two ways:

  • The updater is able to create the ee_update directory within the cache directory and successfully download and write the following directories and files:

    • ExpressionEngine (dir)
    • configs.json
    • ExpressionEngine.zip
    • index.html
    • update.txt
  • Also, I am able to run and successfully complete the Database Backup Utility from the Control Panel, which results in a SQL text file written to \system\user\cache.

While the error code clearly points to a permissions issue, my understanding is that default installations of Apache on Windows Server run under the System account, which has full permissions to the \system\user\cache directory. I have confirmed that permissions for the \system\user\cache directory match the permissions required by the ExpressionEngine installation for other directories and files.

Update: I confirmed that PHP is running as the System account by running the following code:

<?php echo exec('whoami'); ?>

I wondered if differences in the use of \ and / to separate file paths in UNIX and Windows might be an issue, but I am able to navigate to the [Server path]\system/user/cache/ee_update directory given by the update error message from the command line.

I understand that ExpressionEngine runs more smoothly on Apache and PHP in a UNIX environment and there are excellent hosting platforms available, but the client’s IT operating policies require a Windows Server installation.

Any ideas for troubleshooting or a known fix for this issue? Any guidance would be a huge help! Thanks!

       
Robin Sowell's avatar
Robin Sowell
13,158 posts
5 years ago
Robin Sowell's avatar Robin Sowell

I’d be curious what happens if you just put the following in a template with php enabled. This is basically the check it’s failing:

<?php

var_dump(ee('Filesystem')->isWritable('\system/user/cache/ee_update '));

?>

Tweaked so it’s the full path in the error. If it fails it, we can deconstruct the method to see exactly why.

       
rdw's avatar
rdw
3 posts
5 years ago
rdw's avatar rdw

Robin, thanks so much for your help!

I created a template with PHP enabled and included the command above using the full server path to the /ee_update directory.

The template returns the following:

bool(true)
       
Robin Sowell's avatar
Robin Sowell
13,158 posts
5 years ago
Robin Sowell's avatar Robin Sowell

Well, that’s not what I was expecting!

At this point, I generally go in and start dumping some debug.

The only place I see that error message is in system/EE/EllisLab/ExpressionEngine/Service/Logger/File.php around line 42. So- let’s make sure that is where it fails.

if ( ! $this->filesystem->isWritable($log_path))
  {
   throw new \Exception('Log file path not writable: ' . $log_path, 2);
  }

That’s the existing code- just change the message a wee bit so we have confirmation that’s where the error is coming from. ‘Log file path is REALLY not writable’ or something along those lines.

Assuming we are in the right place, then deconstruct isWritable() to see why it fails. That’s in system/EE/EllisLab/ExpressionEngine/Library /Filesystem/Filesystem.php

If I had to bet, I’d bet it’s:

if (($fp = @fopen($path, FOPEN_WRITE_CREATE)) === FALSE)
   {
    return FALSE;
   }

What I don’t understand is why it doesn’t fail in the template.

Anyway- this is how I would attack it. You should be able to spot where it fails the check.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.