Closed aaronfi-skilljar closed 6 years ago
Follow-up symptom:
http://localhost/img_auth.php/Screen_Shot_2018-07-28_at_11.36.04_AM.png
returns:
"Although this PHP script (/img_auth.php) exists, the file requested for output (mwstore://AmazonS3/local-public/Screen_Shot_2018-07-28_at_11.36.04_AM.png) does not."
To fix your problem, you need to move all files from hash subdirectories (e.g. "images/a/b") to top-level directory 'images'.
This works as intended. Normal filesystems (when you store files on the local disc) use these /a/b/ in the path, because it's too slow for them to store everything in 1 big directory. Subdirectories improve performance. But Amazon S3 has the opposite thing: it doesn't really have directories (these a/b/ would be a part of filename, and would make the key distribution worse - more files will start with the same prefix - decreasing the performance).
So the correct configuration for Amazon S3 is to store all images under "images/" without these "a/b/".
You can use AWS CLI to rename all files in S3 bucket from a/b/filename
to filename
BUCKET='place-bucket-name-here'
for i in $(aws s3 ls --recursive s3://$BUCKET/ | awk '{print $4}'); do aws s3 mv s3://$BUCKET/$i s3://$BUCKET/$(basename $i); done
Alternatively, you can use old-style configuration (see the file [tests/travis/OldStyleAWSSettings.php] for an example) and replace
'hashLevels' => 0,
with
'hashLevels' => 2,
This will force the use of "a/b/" paths even with Amazon S3.
Hi. Thanks for the response. Don't think this is my problem -- i.e. this is a new wiki, there are no images uploaded yet.
The problem I'm seeing happens after I upload a new image, with the aws s3 extension already installed.
image shows up successfully in s3, but can't be rendered in the wiki i.e.
/img_auth.php/Screen_Shot_2018-07-28_at_11.36.04_AM.png
fails. mwstore://AmazonS3/local-public/Screen_Shot_2018-07-28_at_11.36.04_AM.png
does not exist
Investigating.
my versions, btw:
MediaWiki | 1.32.0-alpha PHP | 7.2.8 (fpm-fcgi) MySQL | 5.6.10
Should be fixed now. Please confirm the latest version works for you.
Confirmed working, thank you very much!!
Hi. Just seeing if there's some missing config step that would be helpful to add to your installation steps.
I installed your extension, confirmed that uploads are going into my s3 buckets.
But all image links on my wiki are now broken, i.e. /images/1/1c/Screen_Shot_2018-07-28_at_11.36.04_AM.png is now simply /Screen_Shot_2018-07-28_at_11.36.04_AM.png which is a broken link.
Tried several config changes but no luck. e.g. this is for a private wiki. I added $wgUploadPath = $wgScriptPath . "/img_auth.php";
Is there something obvious that I'm overlooking?
Thanks!