Topic on Project:Support desk

Jump to navigation Jump to search

Uploading problems after migrating from 1.26 to 1.31

Serrkind (talkcontribs)


I recently updated our wiki from 1.26 to 1.31. I also updated the OS from Ubuntu 14.04 to Ubuntu 16.04 and from PHP 5 to PHP 7 in the process.

I am now unable to upload any file. I get the following message:

Could not open lock file for "mwstore://local-backend/local-public/b/b7/Images.jpg". Make sure your upload directory is configured correctly and your web server has permission to write to that directory. See$wgUploadDirectory for more information.

I have double checked the upload folder permissions (set for www-data with 755), checked the new PHP7 php.ini file to be sure it was set for file uploads to be allowed, and have the $wgUploadDirectory set for my images folder.

What else am I missing?


Ciencia Al Poder (talkcontribs)

Check if you have SELinux enabled, since it can restrict some operations even if permissions look right.

Also check if PHP is running as the www-data user or it now uses a different user since the upgrade.

Serrkind (talkcontribs)

I do not have SELinux enabled and as far as I can tell, PHP is running as the www-data user through Apache.

Serrkind (talkcontribs)

I was able to get the image upload fixed. I ended up changing the path for the $wgUploadDirectory to "./images" and that seemed to work.

But now I cannot see any image I upload. All I see is the file name and some info about it, recreated below.


No higher resolution available.

Testimages.jpg (190x222 pixels, file size: 8 KB, MIME type: image/jpeg)

Everything seems to work, but I cannot see the image or the thumbnail for the image. When I click on the link for the image I get a page saying there is currently now text in this page instead of seeing an image.

MarkAHershberger (talkcontribs)

Since you've set the upload directory to ./images have you confirmed that images are actually being uploaded to the directory? Can you see new files in it?

It sounds like they may be uploaded to somewhere else.

Serrkind (talkcontribs)

Yes, I can confirm they are in the images folder. The weird thing is it looks like the link for the image is going to a wrong folder.

If I click on a newly uploaded image, it give me the following URL: which give me a blank page.

But my folder should be images, not Images.

If I take out the index.php, and just go to, I can see the image file.

Could the capitalization be causing the issue? and where would I fix that? Anything referring to the images folder in my LocalSettings.php is lower case like the folder itself.

MarkAHershberger (talkcontribs)

It looks like you've got $wgUploadPath set wrong. The upload path is where MediaWiki tells the browser to find the images and the directory is their location on disk.

Does uploading work if you change $wgUploadDirectory back to the default of "${IP}/images"?

MarkAHershberger (talkcontribs)

(Also, your cert expired five years ago. Check out LetsEncrypt for a free way to keep your SSL cert up to date.)

Serrkind (talkcontribs)

Both my $wgUploadDirectory and $wgUploadPath are set for "$IP/images". Uploading works with this setting, but the uploaded images are still not visible.

MarkAHershberger (talkcontribs)
Ciencia Al Poder (talkcontribs)

Your upload directory was configured outside of the MediaWiki directory before? If yes, then the problem is with open_basedir restriction.

Serrkind (talkcontribs)

I changed the $wgUploadPath to "$wgScriptPath/images" and left $wgUploadDirectory as "$IP/images" and got the error that it couldn't create a thumbnail.

I then reset my $wgTmpDirectory from "$wgUploadDirectory/temp" to "$IP/images/temp" and the thumbnail issue was resolved. The temp directory was present with the correct permissions the entire time, FYI.

Thanks for the help. This ended up being more convoluted than I had anticipated.