We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 49515
    • 184 Posts
    Hello,
    I'm trying to install MODX onto a webserver and I receive the error:

    FATAL ERROR: MODX Setup cannot continue.
    Make sure your /home/domain.com/public_html/core/cache directory exists and is writable by the PHP process.

    I've searched for some help on this error, but no clear answers just yet.

    Here are the permissions:
    # ls -al
    total 40
    drwxr-xr-x  7 root               root               4096 Jul 16 17:54 .
    drwxr-x--- 13 domaindotcom domaindotcom 4096 Jul 16 17:49 ..
    lrwxrwxrwx  1 domaindotcom domaindotcom    4 Mar 17 00:35 awstats-icon -> icon
    lrwxrwxrwx  1 domaindotcom domaindotcom    4 Mar 17 00:35 awstatsicons -> icon
    -rw-r--r--  1 root               root                 99 Jun 25 18:45 config.core.php
    drwxr-xr-x  4 root               root               4096 Jun 25 18:46 connectors
    drwxr-xr-x 12 root               root               4096 Jun 25 18:46 core
    -rw-r--r--  1 root               root               3519 Jun 25 18:45 ht.access
    drwxr-xr-x  9 domaindotcom domaindotcom 4096 Oct 29  2014 icon
    -rw-r--r--  1 root               root               2497 Jun 25 18:45 index.php
    drwxr-xr-x  6 root               root               4096 Jun 25 18:46 manager
    drwxr-xr-x  9 root               root               4096 Jun 25 18:46 setup
    
      • 44195
      • 293 Posts
      If using apache can you go into your domain.com dir and type:
      chown -R www-data:www-data public_html
      (sorry typed from my phone)
        I'm lead developer at Digital Penguin Creative Studio in Hong Kong. https://www.digitalpenguin.hk
        Check out the MODX tutorial series on my blog at https://www.hkwebdeveloper.com
        • 49515
        • 184 Posts
        Thanks.
        I think I messed up my directory structure.
        I use /home/domain.com/public_html/files.
        I think MODX likes /home/domain.com/www/files.

        So, I'm trying to apply your command, but haven't figures out what the www-data is for yet.

        I tried # sudo chmod -R 755 public_html. [ed. note: eiger3970 last edited this post 8 years, 9 months ago.]
          • 44195
          • 293 Posts
          As long as the directory is web accessible it shouldn't really matter what the name is. www-data is the apache web server user and that command makes it the owner of everything inside the public_html dir. Therefore theoretically not choking on permission issues.
            I'm lead developer at Digital Penguin Creative Studio in Hong Kong. https://www.digitalpenguin.hk
            Check out the MODX tutorial series on my blog at https://www.hkwebdeveloper.com
          • Basically your problem was that the core directory was owned by "root" and only had read-execute permissions for anybody else (in the case of a directory "execute" permission means that somebody can open the directory to look at what's in it).

            Exactly what permissions and ownership is needed depends entirely on how your server is configured.

            It appears that your web server is configured to use the "public_html" directory as its web root. Most hosting will also have a "www" directory, one is just an alias for the other. It doesn't really matter which one you use, although using the actual directory name may be a little faster.

            The owner of the MODX files should be your user (not "root") which you have showing in your sample as "domaindotcom".

            The tricky part is to determine if your web server is configured to switch to the file owner's user to run a PHP file (like the MODX index.php file). If it is, then when MODX tries to write to the cache it's doing it as your user, so everything will be fine with the permissions you show in your sample, (755 and 644) as long as the owner of everything is your user. Since the "root" user can do everything and anything on the whole server, it's never acceptable to let the web server switch to run .php files as the "root" user.

            If the server is not configured to change to the user that owns the .php file, then it will run as the web server user (this can be "apache", "www", "nobody", or whatever the server administrators set it to be), because the web server is the one running the .php file, then any files and folders that need to be written to must have global write permissions, so the cache folder and all of its files would have to have drwrwx-rwx (777) for folders and rw-rw-rw- (666) for files. This would apply to the core/components/, core/packages/ and the entire assets/ directories as well.

            Setting all the files to be owned by the web server is also a simple option, it all depends on who is administering your server and how much control over it you have. That would be a very bad idea in the case of shared hosting, where hundreds, if not thousands, of total strangers are sharing the server with you, all using the same web server. If it's your own server, or a VPS, then it wouldn't be a problem.

              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 44195
              • 293 Posts
              Ah yes, very good point about www-data and shared servers! smiley
                I'm lead developer at Digital Penguin Creative Studio in Hong Kong. https://www.digitalpenguin.hk
                Check out the MODX tutorial series on my blog at https://www.hkwebdeveloper.com
                • 49515
                • 184 Posts
                Thanks for the info. Fixed.
                However the next step gives an error, which I posted in a new forum post http://forums.modx.com/thread/97728/access-denied-for-user-039-modxdatabase-039-039-localhost-039-using-password-yes#dis-post-528534 [ed. note: eiger3970 last edited this post 8 years, 9 months ago.]