News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Permissions Issues with Attachments after moving servers

Started by Vince S, March 25, 2017, 02:04:06 AM

Previous topic - Next topic

Vince S

Hi,

I have searched and read lots of other experiences with moving servers. There are a lot of factors it seems and I am reluctant to do more boofy footed guesswork, so would appreciate a little guidance. The host is SiteGround and I have consolidated my various basic hosted accounts to a GoGeek account. They did the site transfer of the one including the smf but it seems to have been a pretty rough 'n readie job done as the one free transfer that comes with the upgrade, so just working through residual issues.

My smf 2.0.13 forum issue is as simple as that attached files to posts don't show thumbnails, and clicking their url gets "404 - Attachment Not Found". Yet, from the ref in the url, they can be seen via cPanel File Manager and view properly if opened there. If I post a test reply and attach a pic I get "An Error Has Occurred! The attachments upload directory is not writable. Your attachment or avatar cannot be saved."

If I go to Admin Forum Attachments & Avatars and click on File Maintenance I get "An Error Has Occurred! Cannot access attachments upload path!". Well that is pretty plain!

Obviously there is a permissions issue of some kind, but checking via cPanel's File Manager says they are 755 on the attachments directory, which should be fine?

The site is secured via a SiteGround Lets Encrypt certificate, and all url's anywhere in forum settings have been changed to show https and obviously the new account server reference.

When I logged the issue with SiteGround support one of the actions was to notice the .htaccess file in the attachments directory had the effect of banning all, so they commented the thing out. I expect that was a mistake as it was 9 years old and I expect the file is there to prevent backdoor attacks via uploaded attachments becoming directly accessible, should I reinstate this file?

I have used PHP Version manager to set it to 5.5.38 so the (standard Curve) theme would work (was on 7.0 and I was getting errors and text style screens). Now I am not sure if that needed to happen as disabling the WordFence plugin on a WordPress site in the root directory is what it took to let me edit the theme directories to look in the right places and start working (not sure about that either, could have been CloudFlare). Should I leave it on php 5.5.38 or go with a later version?

Re mySQL, in phpMyAdmin under Database Server is:
Server version: 5.6.28-76.1-log - Percona Server (GPL), Release 76.1, Revision 5759e76

under Web Server is:
Database client version: libmysql - 5.1.73

I must have missed something simple, hoping the brains trust here can point me in the right direction. Thank you.

Edit: a potential sub-problem of this is the Yahoo Instant Messenger icon and link under avatars doesn't work - a thumbnail sized box gets displayed and the link is a fail. I can't find what puts these things there and wonder if it is related to the permissions issue talked about above? Thanks again.

Edit PS: Aha, solved the Yahoo IM issue. If the user closes their account you get the oversize ugly box. So maybe that is a feature request that an account error doesn't do this - hive it off as you like! And the setting turned up in Configuration, Features & Options, Profile Fields.
Try figuring out where all this is going to keep coming from: Millionaire Baby? Or just pass me a beer and we'll sort it, thank you.....

Kindred

Repair_settings.php needs to be run after moving your site files.
What you are seeing indicates that the attachment path and URL were not updated after the move.

Yes, out that htaccess file back.

Wordpress often does not play nicely with other scripts

Yahoo IM is broken, thanks to yahoo. The fix is to disable yahoo IM and remove it from everyone's profile settings.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Vince S

Thank you Kindred, that cleared it up and sorted all my issues.

I am yet to find and run Repair_settings.php, but what I found is my core issue was an error in the format of the directory settings. For the benefit of others, it is like this:

I have a hosted account with multiple add-on domains. What this does is get each domain in a sub-directory of public_html and the forum is a sub-directory of that. So, if my account name is MyAccount and the domain name is www.mydomain.org the format of the directory path is as follows:

/home/MyAccount/public_html/mydomain.org/DiscussionBoard/attachments

The above is what should be in the attachment settings. Don't forget the related similar one for avatars, which has a url address of https://mydomain.org/DiscussionBoard/avatars (note http or https depending on if you have an SSl certificate on the site)

Also the server settings paths are in a similar format. Note that, despite that these are all paths to directories, none of them have a trailing /. I don't know if that's important, but no url or path in my settings has it so that must be OK!

I am now going to find and read the repair file and see if I should run it. Now in the box of "if it ain't broke don't fix it", so a little gun shy of running something on a perfectly functional (to my knowledge) smf forum...
Try figuring out where all this is going to keep coming from: Millionaire Baby? Or just pass me a beer and we'll sort it, thank you.....

Vince S

I shouldn't have worried - Repair_settings.php is a beautiful piece of software! Turned out I had missed smilies directory too. Just click on each correct link (in blue) and see which ones the text changes for, then you will know what you missed. There were a couple of other minor things I am guessing were legacy issues from the upgrade process over the decades, so it looks like a good maintenance tool to run just for that purpose alone.

There are instructions and a download link here: http://wiki.simplemachines.org/smf/Repair_settings.php

The way to run it is exactly as expected, ie go to your forum and add repair_settings.php to the end of the main url (ie www.mydomain/forum/repair_settings.php). If you get a 404 error almost certainly you put a capital R at the beginning - file names are case sensitive and unfortunately all the documentation is about a capital R file, which lives in an alternate universe to the real thing. You get that.....! It's all good.

Edit PS: Wow, changing the cookie name back to default tidied up some really irritating editing issues where I had to change a setting multiple times before it would "catch". ie if it was there on a Shift F5 (which forces a full page refresh) then I believed it, often it wasn't, sometimes it was. Now it is just there after hitting save. And to think I was blaming Cloudflare and thinking this is just the price you pay for a fast caching system...
Try figuring out where all this is going to keep coming from: Millionaire Baby? Or just pass me a beer and we'll sort it, thank you.....

Advertisement: