Application/files must be writable by web server

I’m trying to install 9.2.9 using composer as described here: composer/README.md at master · concretecms/composer · GitHub

When I try to install it with

php ./vendor/bin/concrete c5:install  -i

I get the error:

- Writable Files and Configuration Directories... This directory must exist a
nd it must be writable by your web server: application/files/

I created this directories manually and set their permissions to 777 (Basic Setup & Installation) but the error persists. It seems I don’t have suexec or phpsuexec available.

How can I fix this?

php version is 8.1

1 Like

I don’t get it: when I do

php -r 'echo is_writable("./application/files/") ? "yes" : "no";'

I get a “yes”.

If I put this in index.php:

<?php
    php -r 'echo is_writable("./application/files/") ? "yes" : "no";'
?>

and open the site in a web browser, I get a “yes”.

This really looks like a bug in the installer to me. Very frustrating.

Do you really need a composer install?

Installing from the downloaded zip and the CLI is very reliable.

@lineinthesand this isn’t actually a PHP file that can be served by Apache or Nginx.

Try this:

<?php
var_dump(is_writable(__DIR__ . '/application/files'));

If the application/files directory is writable by the webserver, you should see

bool(true)

if it’s not writable, you’ll see:

bool(false)

can you please guide me where I can post my query regarding to installation.

I’m sorry I don’t understand which query you are referring to…

Just to follow up: it gives bool(true), yet I get the same error message insisting application/files was not writable. I’m now trying this on a local virtual host where I can try anything. Do you have any more ideas?

I just put these commands in ./vendor/bin/concrete:

echo exec('whoami');
var_dump(is_writable(__DIR__));
var_dump(is_writable( '/application/config'));
var_dump(is_writable('/packages'));

And I got my username for the whoami command and got bool(true) for the first one and two times bool(false).
I tried executing this from a root prompt:

sudo -u wwwrun -g wwwrun  ./vendor/bin/concrete c5:install -i

and got the wwwrun user for the whoami command but I see three bool(false).
I’m confused now: apache does run as wwwuser (as confirmed by executing whoami in index.php) but php runs as my user and can write to ./vendor/bin/concrete, but if it runs as wwwuser still can’t write to the relevant directories required by the script.

So it’s apparently a misconfiguration of my system but I can’t figure out how to get that right.

Please remark that this way you are checking absolute paths.
If you want to check the application/config and packages directory under the directory where you have your script, you should write

var_dump(is_writable(__DIR__ . '/application/config'));
var_dump(is_writable(__DIR__ . '/packages'));

The script is in ./vener/bin, so I did:

var_dump(is_writable(__DIR__));
var_dump(is_writable(__DIR__.'/../../'));
var_dump(is_writable(__DIR__.'/../../application/files'));
var_dump(is_writable(__DIR__.'/../../application/config'));
var_dump(is_writable(__DIR__.'/../../packages'));

And all are bool(true). Whaaat? So why does the script complain when I do:

./vendor/bin/concrete c5:install -i

in my webroot? I don’t get it.

The install step check if directories are writable at this line:

And $fs->isWritable() runs this code:

So, there’s no bug in the core.

PS: in order to help people determining the correct system user, I’ve suggested this update to the core: