Internal server error, or all the links, without icons. What's wrong with .htaccess?

If I donā€™t change my .htaccess file, I have 500- Internal server error, and if I changed it to /suitecrm/public, I get this kind of screen. Please see screenshot.

2022-07-14 09:46:46 UTC [apache][core:crit] [pid 8024] (13)Permission denied: [client 112.205.146.22:23678] AH00529: /home/u23458-nf9jx9mile1e/www/crm.nxx.ph/public_html/suitecrm/public/legacy/cache/themes/suite8/css/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that ā€˜/home/u23458-nf9jx9mile1e/www/crm.nxx.ph/public_html/suitecrm/public/legacy/cache/themes/suite8/css/ā€™ is executable, referer: https://crm.nxx.ph/legacy/index.php?module=Home

This is part of my .htaccess file:

<IfModule mod_rewrite.c>
    Options +SymLinksIfOwnerMatch
    Options -Indexes
    Options -MultiViews
    RewriteEngine On
    RewriteBase /suitecrm/public/
    RewriteRule ^cache/jsLanguage/(.._..).js$ index.php?entryPoint=jslang&modulename=app_strings&lang=$1 [L,QSA]
    RewriteRule ^cache/jsLanguage/(\w*)/(.._..).js$ index.php?entryPoint=jslang&modulename=$1&lang=$2 [L,QSA]

    # --------- DEPRECATED --------
    RewriteRule ^api/(.*)$ - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteRule ^api/(.*?)$ lib/API/public/index.php/$1 [L]
    # -----------------------------

    RewriteRule ^Api/(.*)$ - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteRule ^Api/access_token$ Api/index.php [L]
    RewriteRule ^Api/V8/(.*?)$ Api/index.php [L]
</IfModule>

Hello. Anyone have ideas?

That looks like ownership/permissions problemsā€¦

Itā€™s not complaining about something inside htaccess, itā€™s complaining about the inability to read the htaccess fileā€¦

And all the other missing CSS and images and labels point to the same root cause.

If you go in Admin / Schedulers, what do the crontab instructions say, exactly? From those instructions we can get to know the user name under which your web server is running. This will allow you to set the correct ownerships.

Hello @pgr

Siteground, where this crm is hosted, did the following, and it worked:

It seems some of the files had wrong permissions, so I applied 644 to all files in your CRM folder and 755 to all folders.

Though what I donā€™t understand is from the onset, I already went to change suitecrm folder permissions to 755, even ticked recursive.

Now all seems well, except for the undefined fields in quotations, Iā€™ll update my other post.

Sometimes permissions have to be reapplied. If your settings werenā€™t correct when SuiteCRM created some cache directories, they might still there with incorrect permissions.

If youā€™re still seeing undefineds, something is still wrong.

I donā€™t know why you mention 644, and 755, where did you get that from? Itā€™s best to follow the guides.

And please pay attention to file and directory ownerships. Permissions donā€™t mean anything without ownerships.

I would start by going in Admin / Schedulers and looking at the crontab instructions at the bottom. This will tell us the user name that your web server is running under. Then we can check the correct ownerships based on that.

the 644 and 755 were applied by the Siteground guys. I believe I made them all 755.

To Setup Crontab
In order to run SuiteCRM Schedulers, edit your web server userā€™s crontab file with this command:
sudo crontab -e -u u2348-nf9jx9mile1e
ā€¦ and add the following line to the crontab file:

          • cd /home/customer/www/crm.nii.ph/public_html/suitecrm/public/legacy; php -f cron.php > /dev/null 2>&1

Itā€™s possible that neither of those will work. This is not random stuff. If you provide the requested information I can try to help further.

By requested information, you mean I setup crontab, correct? Iā€™m reading how to create a cron job with Siteground now.

Not setting up crontab, I just need the username that is written in the instructions. Then you can check if that is the same user that owns files and directories.

Isnā€™t this it? u2348-nf9jx9mile1e

From command:

sudo crontab -e -u u2348-nf9jx9mile1e

Cool. So if your files and directories are owned by that user, all the permissions youā€™re setting are using the first digit only: 644, 755

If the files are owned instead by a group (assuming the user belongs to that group), they will use the second digit only 644, 755.

If the files are owned by some other user, or a group to which your user doesnā€™t belong, they will use the third digit only 644, 755.

This is what is recommended in the guide for people with user www-data:

  sudo chown -R www-data:www-data .
  sudo chmod -R 755 .
  sudo chmod -R 775 cache custom modules themes data upload
  sudo chmod 775 config_override.php 2>/dev/null

Essentially, in that case all those settings will give a 7 access to SuiteCRM (first digits used). And using 700 would work just the same.

Itā€™s possible that Siteground doesnā€™t even let you touch ownerships, but if so, youā€™ll probably find all files already belong to your user.

So, go for something that uses 7 in the first digit (I suggest 750), apply recursively. Then run a Quick Repair and Rebuild.

should mine be

sudo chown -R u2348-nf9jx9mile1e:u2348-nf9jx9mile1e .
sudo chmod -R 755 .
sudo chmod -R 775 cache custom modules themes data upload
sudo chmod 775 config_override.php 2>/dev/null

I can see u2348-nf9jx9mile1e everywhere. But just to be sure, I think I should just run it all over again
I should be doing that in inside suitecrm folder?

sudo chmod -R 775 cache custom modules themes data upload - only cache is visible from suitecrm folder. Does it mean I have to go find custom (inside public/legacy) and so on and so forth, and execute sudo chmod command 1 by 1? Though I found out that custom, modules, themes, data and upload are all inside public/legacy, and can be executed simultaneously.

edit:

I went ahead and did the commands above. I still get this error:

Is that SuiteCRM v8? I didnā€™t guess that, so Iā€™ve been working with the guide from v7.

Did you follow the v8 guide at all? The permissions instructions given there (which are different)?

Also: did you use the installer package downloaded from SuiteCRM site? Or some other method like Softaculous install, or some CPanel menu option, or pulling from git?

Tried to follow the guide, but canā€™t keep up with the permissions until your instructions earlier made it clear. Iā€™ll follow the permissions needed in the V8 documentation.

Didnā€™t use any Softaculous, or cPanel. Itā€™s no longer available in Siteground. This is download, extract, and run the installer just like the documentation.

Ok, so these are the ones you need, just replace www-data with your user name:

find . -type d -not -perm 2755 -exec chmod 2755 {} \;
find . -type f -not -perm 0644 -exec chmod 0644 {} \;
find . ! -user www-data -exec chown www-data:www-data {} \;
chmod +x bin/console

You might need to put a ā€œsudoā€ before each of those

Executed commands above, in suitecrm root foler.

Then did a Quick Repair and rebuild. Logout, and logged back in. Same results.

1 Like

I donā€™t know, then. The only thing that occurs to me is to start over, but doing everything correctly and in order. Itā€™s possible that running the installer with broken permissions left your system in a really weird half-installed stateā€¦

Thanks pgr. Will reinstall 1 last time. If not working, will shift to the v7.

Hi pgr,

After re-applying all the permissions above once again, and making sure .htaccess files have RewriteBase /suitecrm/public/legacy and doing another round of Quick Repair, it finally worked :smiley:

Thank you pgr!

1 Like