(Ubuntu) Write permissions are required for web/settings.php

CMS Version

3.1.1

Installation Method

Custom install

Operating System

Ubuntu Server 20.04.4 LTS, Kernel 5.4.0-109-generic
Apache 2.4.41, PHP 7.4.3

Issue

On a clean/fresh installation and I get the error message in the title and all other requirements are satisfied.
Web user / group is the default of www-data:www-data and owns the folders all the way down to /var/www. The path where the archive was extracted was /var/www/xibo/
Permissions for folders are set to 775 and files are 664 and should NOT be having any issue.
To verify this, I created a test.php file in the install folder that creates an output file called “test.log” and saved some text as proof Apache/PHP can write to the “web/install” folder. I then moved test.php to the parent “web” folder and performed the same test which successfully created the output file from a web browser.

This is the script I used to test write-ability:

<?php
error_reporting(E_ALL);
$filename = "test.log";
$myfile = fopen($filename, "w") or die("Unable to open file!");
$txt = "Hello World\n";
fwrite($myfile, $txt);
$user = fileowner($filename);
$txt = "Web UserID is ".$user."\n";
fwrite($myfile, $txt);
fclose($myfile);
if (is_readable($filename)) {
  echo "$filename is readable<br>";
}
if (is_writable($filename)) {
  echo "$filename is writable<br>";
}
if (is_executable($filename)) {
  echo "$filename is executable<br>";
}
?>

Here is the output of a directory listing in “/var/www/xibo/web/install” after running test.php which created the test.log file:

-rw-rw-r-- 1 www-data www-data 3141 Apr 12 03:35 index.php
-rw-r--r-- 1 www-data www-data   29 Apr 20 14:22 test.log
-rw-rw-r-- 1 www-data www-data  486 Apr 20 14:15 test.php

Here is the output of a directory listing in “/var/www/xibo/web” after running test.php which created the test.log file:

drwxrwxr-x 3 www-data www-data   4096 Apr 12 03:35 api
drwxrwxr-x 6 www-data www-data  12288 Apr 12 03:53 dist
-rw-rw-r-- 1 www-data www-data   4293 Apr 12 03:35 index.php
drwxrwxr-x 2 www-data www-data   4096 Apr 20 14:24 install
-rw-rw-r-- 1 www-data www-data     25 Apr 12 03:35 robots.txt
-rw-rw-r-- 1 www-data www-data 688991 Apr 12 03:35 swagger.json
-rw-r--r-- 1 www-data www-data     29 Apr 20 14:29 test.log
-rw-rw-r-- 1 www-data www-data    485 Apr 20 14:25 test.php
drwxrwxr-x 5 www-data www-data   4096 Apr 12 03:53 theme
drwxrwxr-x 2 www-data www-data   4096 Apr 12 03:53 userscripts
-rw-rw-r-- 1 www-data www-data  12777 Apr 12 03:35 xmds.php

Here is the “/var/www/xibo” folder above the web root:

drwxrwxr-x  2 www-data www-data  4096 Apr 12 03:35 bin
drwxrwxr-x  2 www-data www-data  4096 Apr 12 03:53 ca-certs
drwxrwxr-x  5 www-data www-data  4096 Apr 20 09:09 cache
drwxrwxr-x  2 www-data www-data  4096 Apr 12 03:53 custom
drwxrwxr-x  3 www-data www-data  4096 Apr 12 03:35 db
drwxrwxr-x 22 www-data www-data  4096 Apr 12 03:35 lib
drwxrwxr-x  3 www-data www-data  4096 Apr 20 09:09 library
-rw-rw-r--  1 www-data www-data 34501 Apr 12 03:35 LICENSE
drwxrwxr-x  2 www-data www-data  4096 Apr 12 03:35 locale
drwxrwxr-x 18 www-data www-data 12288 Apr 12 03:35 modules
-rw-rw-r--  1 www-data www-data  2219 Apr 12 03:35 phinx.php
-rw-rw-r--  1 www-data www-data  5576 Apr 12 03:35 README.md
drwxrwxr-x  2 www-data www-data  4096 Apr 12 03:35 reports
drwxrwxr-x  2 www-data www-data  4096 Apr 12 03:35 tasks
drwxrwxr-x 57 www-data www-data  4096 Apr 12 03:37 vendor
drwxrwxr-x  2 www-data www-data 20480 Apr 12 03:35 views
drwxrwsr-x  7 www-data www-data  4096 Apr 20 14:29 web

Here is the “/var/www” folder:

drwxr-xr-x  2 www-data root     4096 Apr 19 17:26 html
drwxrwxr-x 16 www-data www-data 4096 Apr 19 17:26 xibo

is that normal there is no settings.php in your web folder ?

Yes, because it is a brand new installation. The archive used to setup the system does not have one because it generates one during the install process…which is where I am seeing this error message. If you create an empty “settings.php” file, the installer will not run and will simply error out because the database connection info and other settings are not configured in the file.

This is the source where I obtained the manual install archive:
https://github.com/xibosignage/xibo-cms/releases/download/3.1.1/xibo-cms-3.1.1.tar.gz

The best practice is to allow the installation to have write access during initial setup but then remove write access once in production mode…which I did not get that far yet in the process. (but it needs to continue write access to the library folder for obvious reasons…which is also why it is not directly accessible from the web root)

i just try to install fresh 3.1.1 (with the same link) on my debian, and i got the same error about writing acces for settings.php even if there is no settings.php

apache 2.4.53
php 7.4.28
debian 11.3

This is apparently a coding bug in version 3.1.0 and 3.1.1. When I used the 3.0.8 archive, it passed the “writeable” test.

Here are the install steps I performed for each test but this is the one for the working 3.0.8

wget https://github.com/xibosignage/xibo-cms/releases/download/3.0.8/xibo-cms-3.0.8.tar.gz -O /tmp/xibo.tar.gz
sudo mkdir -p /var/www/xibo
sudo tar xvzf /tmp/xibo.tar.gz -C /var/www/xibo/ --strip-components=1
sudo chown www-data:www-data --recursive /var/www/xibo
sudo find /var/www/xibo/. -type d -exec chmod 755 '{}' \+
sudo find /var/www/xibo/. -type f -exec chmod 644 '{}' \+
rm /tmp/xibo.tar.gz

NOTE: I was setting even less strict permissions earlier with folders set to 775 and files at 664 just for test purposes but the archives themselves use 755 / 644 for most everything so once I saw it work for 3.0.8, that is what I used.

Sorry this was a silly mistake on my part:

3.1.2 will have a fix (patch in above issue) - but you can safely ignore that error in the meantime, or install 3.0.8 and upgrade as you’ve done.

Thanks,
Dan

Thank you for the quick fix. I have an ancient 1.7.8 installation that was initially put on an Ubuntu 16.04 server which I migrated to 18.04 with some back-reving of php for compatibility and was looking to see if I could install the latest version of Xibo onto the current version of Ubuntu 20.04 (well…22.04 when patch 1 comes out). We have a ton of licensed Android players but looking to replace them with Linux players but was surprised to find out that there doesn’t seem to be a need for any licensing in this scenario.

After a quick test, v3.0.8 is working with a Windows player with relative ease (I did need to play around a bit to learn the different interface compared to 1.7.8). I am working on a how-to article for Xibo on my spare time. Hopefully I will be allowed to finish it.
https://hammondslegacy.com/forum/viewtopic.php?f=40&t=300

1 Like

Yes absolutely, the linux player is released under the same AGPLv3 licence as the CMS and the windows player.

What I would say is that we do have some fairly tricky code issues to overcome with the linux player - see Project Status - future plans · Issue #249 · xibosignage/xibo-linux · GitHub.

That looks great - let us know when you’ve finished it and @natasha can add it to the guides category.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.