Directories Must Be Writeable By Your Web Server

Issues related to applications and software problems
User avatar
FazzaGBR
Posts: 15
Joined: 2017/12/05 15:54:11

Directories Must Be Writeable By Your Web Server

Post by FazzaGBR » 2017/12/06 09:16:43

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! :)

User avatar
TrevorH
Site Admin
Posts: 33219
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Directories Must Be Writeable By Your Web Server

Post by TrevorH » 2017/12/06 09:29:51

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.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

User avatar
FazzaGBR
Posts: 15
Joined: 2017/12/05 15:54:11

Re: Directories Must Be Writeable By Your Web Server

Post by FazzaGBR » 2017/12/06 09:52:13

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

pjsr2
Posts: 614
Joined: 2014/03/27 20:11:07

Re: Directories Must Be Writeable By Your Web Server

Post by pjsr2 » 2017/12/06 10:04:35

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

User avatar
TrevorH
Site Admin
Posts: 33219
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Directories Must Be Writeable By Your Web Server

Post by TrevorH » 2017/12/06 10:16:05

For the mysql PDO problem, do you have php-pdo.x86_64 installed?
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

User avatar
FazzaGBR
Posts: 15
Joined: 2017/12/05 15:54:11

Re: Directories Must Be Writeable By Your Web Server

Post by FazzaGBR » 2017/12/06 10:17:04

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?

User avatar
TrevorH
Site Admin
Posts: 33219
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Directories Must Be Writeable By Your Web Server

Post by TrevorH » 2017/12/06 10:32:00

It needs a -t in there

sudo semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/packages(/.*)?'
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

User avatar
FazzaGBR
Posts: 15
Joined: 2017/12/05 15:54:11

Re: Directories Must Be Writeable By Your Web Server

Post by FazzaGBR » 2017/12/06 10:39:03

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 :(

User avatar
TrevorH
Site Admin
Posts: 33219
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Directories Must Be Writeable By Your Web Server

Post by TrevorH » 2017/12/06 10:41:19

That was an example so you need to repeat that for the other directories it listed.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

User avatar
FazzaGBR
Posts: 15
Joined: 2017/12/05 15:54:11

Re: Directories Must Be Writeable By Your Web Server

Post by FazzaGBR » 2017/12/06 10:54:58

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
Last edited by FazzaGBR on 2017/12/06 11:30:54, edited 1 time in total.

Post Reply