Page 1 of 3

Directories Must Be Writeable By Your Web Server

Posted: 2017/12/06 09:16:43
by FazzaGBR
I've been having fun installing Concrete5 on CentOS 7 over the last few days and each time I have a problem I'm learning something! :)

My current problem is that when I browse to the server in a web browser the initial configuration prerequisites are failing on these two:
  • MySQL PDO Extension Enabled
    Writeable Files and Configuration Directories
With regards to the second one I have run the following commands:

Code: Select all

chmod -R 777 packages/
chmod -R 777 application/files
chmod -R 777 application/config
(I tried 775 first but that didnt work either)

I have also run:

Code: Select all

chown -R apache:apache /var/www/html
Still to no avail.

Am I running the right commands correctly as I clearly missing something - hopefully a newbie mistake that someone can point out?

Thanks! :)

Re: Directories Must Be Writeable By Your Web Server

Posted: 2017/12/06 09:29:51
by TrevorH
chown -R apache:apache /var/www/html
You don't want to do that as that allows the apache httpd daemon write access to its own docroot which opens up the possibility that an attacker can write files to it remotely. It should be owned root:root and chmod 755. Specific subdirectories can be changed to be root:apache and 775 if write access is required to those.

However, selinux also stops write access to that directory and if you need to allow writes to specific directories such as cache or images then you'll need to use semanage fcontext to add rules to allow this.

Re: Directories Must Be Writeable By Your Web Server

Posted: 2017/12/06 09:52:13
by FazzaGBR
Thanks for your help :)

I've run chmod -R 755 on the concrete5 directory and then run the following:

Code: Select all

chmod -R 775 packages/
chmod -R 775 application/config/
chmod -R 775 application/files/
These are the directories the error says it needs to be able to write to but I'm still getting the error.

Imageconcrete5prerequisites

Re: Directories Must Be Writeable By Your Web Server

Posted: 2017/12/06 10:04:35
by pjsr2
The selinux rules give by default only read access. You will have so add selinux attributes that permit writing in these directories by the web server as well.
Look at your selinux attributes with the command:

Code: Select all

ls -lZ /var/www/html/packages
Something like the following does the trick for giving write permissions on /var/www/html/packages:

Code: Select all

sudo semanage fcontext -a httpd_sys_rw_content_t "/var/www/html/packages(/.*)?"
sudo restorecon -R -F /var/www/html/packages

Re: Directories Must Be Writeable By Your Web Server

Posted: 2017/12/06 10:16:05
by TrevorH
For the mysql PDO problem, do you have php-pdo.x86_64 installed?

Re: Directories Must Be Writeable By Your Web Server

Posted: 2017/12/06 10:17:04
by FazzaGBR
Thank you very much for your help, it is much appreciated!

I've run the semanage command but get an unrecognized argument error:

Image

Have I mis-typed something?

Re: Directories Must Be Writeable By Your Web Server

Posted: 2017/12/06 10:32:00
by TrevorH
It needs a -t in there

sudo semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/packages(/.*)?'

Re: Directories Must Be Writeable By Your Web Server

Posted: 2017/12/06 10:39:03
by FazzaGBR
I added the -t and that command worked :) I then ran the other command, restarted the server and tried the installation again...

I'm still getting the same errors :(

Re: Directories Must Be Writeable By Your Web Server

Posted: 2017/12/06 10:41:19
by TrevorH
That was an example so you need to repeat that for the other directories it listed.

Re: Directories Must Be Writeable By Your Web Server

Posted: 2017/12/06 10:54:58
by FazzaGBR
LOL - I misunderstood and did this:

Image

I have a stinking cold at the moment so I'm using that as my excuse!! Do I need to reverse what I did above?


I've successfully run the two commands on all three directories (followd by a quick reboot just in case) but I'm really sorry but the error is still there.

TrevorH wrote:For the mysql PDO problem, do you have php-pdo.x86_64 installed?
I guess not! Just tried to install it and there is a conflict:

Image