Mautic 7 installation error: “The directory must be writable” (PHP 8.4) – Missing var/logs folder

Your software
My Mautic version is: 7x
My PHP version is: 8.4
My Database type and version is:

Your problem
My problem is:

While installing Mautic 7 using the recommended Composer method with PHP 8.4, the installer may stop with the following message:

Major Problems that need to be fixed now

We have detected 1 major problems. You must fix them before continuing:

The directory must be writable. Change the permissions of the directory so that the web server can write into it.

These errors are showing in the log:

In my case, permissions were already correct and the web server was able to write to the filesystem, but the installer still reported the error.

Steps I have tried to fix the problem:

Root cause

When creating the project using Composer:

composer create-project mautic/recommended-project:^7 mautic

the directory var/logs is not created.

Solution

Simply create the missing directory manually and give it the correct permissions.

example:

cd /path/to/mautic

mkdir -p var/logs
chmod 775 var/logs
chown -R : var/logs

After creating the folder, refresh the installer and the error disappears.

My directory structure

mautic/
├── config/
├── docroot/
├── var/
│ ├── cache/
│ ├── logs/
│ └── tmp/

Tip for fresh installations

After installing Mautic with Composer, it is a good idea to ensure the runtime directories exist:

mkdir -p var/cache var/logs var/tmp
chmod -R 775 var

This prevents installation issues related to missing runtime directories.

Under Linux, files are 0644 and directories are 0755

To fix the permissions:
cd /path/to/mautic
find . -type f | xargs chmod 0644
find . -type d | xargs chmod 0755

Other tip:
Make sure that your prompt is starting with a $ and not a #. In other words, don’t be root***

** The root user is never required to manage a web app. If you do, you’re doing it wrong.*

1 Like

Hello Alex,

which version of Mautic 7 are you using?
See this issue on the 7.0.0: