Topic on Project:Support desk

Can't upload images from Windows 7 client to Ubuntu wiki host

8
Summary by Coderbynature

In order to get image files to upload I had to change the ownership of my images directory:

sudo chown www-data:www-data -R /var/lib/mediawiki/images

Coderbynature (talkcontribs)

It seems like it's some sort of permissions issue. I get the follow error:

[2f0f4450] /mediawiki/index.php/Special:Upload MWException from line 1856 of .../includes/filerepo/file/LocalFile.php: Could not acquire lock for 'Stephenw_lake640.jpg.'

Backtrace:

#0 .../includes/filerepo/file/LocalFile.php(1148): LocalFile->lock()
#1 .../includes/upload/UploadBase.php(715): LocalFile->upload(string, string, string, integer, array, boolean, User)
#2 .../includes/specials/SpecialUpload.php(476): UploadBase->performUpload(string, string, boolean, User)
#3 .../includes/specials/SpecialUpload.php(195): SpecialUpload->processUpload()
#4 .../includes/specialpage/SpecialPage.php(384): SpecialUpload->execute(NULL)
#5 .../includes/specialpage/SpecialPageFactory.php(582): SpecialPage->run(NULL)
#6 .../includes/MediaWiki.php(267): SpecialPageFactory::executePath(Title, RequestContext)
#7 .../includes/MediaWiki.php(566): MediaWiki->performRequest()
#8 .../includes/MediaWiki.php(414): MediaWiki->main()
#9 .../index.php(41): MediaWiki->run()
#10 {main}

I'm running Windows 7 and get the same error whether I use Google Chrome or Internet Explorer.

The file I'm trying to upload is a 640 wide jpeg image.

MediaWiki is installed on a Linux Ubuntu server and apart from not being able to upload images has been working great.

My /var/www/html/images director is owned by www-data and has drwxr-xr-x permissions.

My /var/www/html/mediawiki/LocalSettings.php file has:

$wgEnableUploads = true;

My php.ini file has uploads enabled.

I'm guessing that the PHP script running on the Ubuntu server is failing to get some sort of permission either on the Ubuntu server or the Windows 7 PC.

I'm not sure what else to try.

Any and all help is greatly appreciated!

Thanks,

Stephen White

MarkAHershberger (talkcontribs)

You don't say what version of MW you're using -- that might help.

I'm pretty sure this has nothing to do with Windows, although you didn't indicate if you could upload from any other system.

I was going to tell you to turn on the debug log but the code doesn't look like it has any good debugging statements.

So, as a last resort, I'll ask you to turn on PHP errors and see if any are reported.

Coderbynature (talkcontribs)

Doh! Sorry, I'm using MediaWiki 1.25.1.

Coderbynature (talkcontribs)

Warning: failed to mkdir "/var/lib/mediawiki/images/lockdir" mode 0777 [Called from wfMkdirParents in /var/lib/mediawiki/includes/GlobalFunctions.php at line 2540] in /var/lib/mediawiki/includes/debug/MWDebug.php on line 300

Warning: fopen(/var/lib/mediawiki/images/lockdir/f00smt22fqj94kquid3mc8ueuj5nipj.lock): failed to open stream: No such file or directory in /var/lib/mediawiki/includes/filebackend/lockmanager/FSLockManager.php on line 125

Warning: failed to mkdir "/var/lib/mediawiki/images/lockdir" mode 0777 [Called from wfMkdirParents in /var/lib/mediawiki/includes/GlobalFunctions.php at line 2540] in /var/lib/mediawiki/includes/debug/MWDebug.php on line 300

Warning: fopen(/var/lib/mediawiki/images/lockdir/f00smt22fqj94kquid3mc8ueuj5nipj.lock): failed to open stream: No such file or directory in /var/lib/mediawiki/includes/filebackend/lockmanager/FSLockManager.php on line 125

Warning: failed to mkdir "/var/lib/mediawiki/images/lockdir" mode 0777 [Called from wfMkdirParents in /var/lib/mediawiki/includes/GlobalFunctions.php at line 2540] in /var/lib/mediawiki/includes/debug/MWDebug.php on line 300

Warning: fopen(/var/lib/mediawiki/images/lockdir/f00smt22fqj94kquid3mc8ueuj5nipj.lock): failed to open stream: No such file or directory in /var/lib/mediawiki/includes/filebackend/lockmanager/FSLockManager.php on line 125

Warning: failed to mkdir "/var/lib/mediawiki/images/lockdir" mode 0777 [Called from wfMkdirParents in /var/lib/mediawiki/includes/GlobalFunctions.php at line 2540] in /var/lib/mediawiki/includes/debug/MWDebug.php on line 300

Warning: fopen(/var/lib/mediawiki/images/lockdir/f00smt22fqj94kquid3mc8ueuj5nipj.lock): failed to open stream: No such file or directory in /var/lib/mediawiki/includes/filebackend/lockmanager/FSLockManager.php on line 125

Warning: failed to mkdir "/var/lib/mediawiki/images/lockdir" mode 0777 [Called from wfMkdirParents in /var/lib/mediawiki/includes/GlobalFunctions.php at line 2540] in /var/lib/mediawiki/includes/debug/MWDebug.php on line 300

Warning: fopen(/var/lib/mediawiki/images/lockdir/f00smt22fqj94kquid3mc8ueuj5nipj.lock): failed to open stream: No such file or directory in /var/lib/mediawiki/includes/filebackend/lockmanager/FSLockManager.php on line 125

Warning: failed to mkdir "/var/lib/mediawiki/images/lockdir" mode 0777 [Called from wfMkdirParents in /var/lib/mediawiki/includes/GlobalFunctions.php at line 2540] in /var/lib/mediawiki/includes/debug/MWDebug.php on line 300

Warning: fopen(/var/lib/mediawiki/images/lockdir/f00smt22fqj94kquid3mc8ueuj5nipj.lock): failed to open stream: No such file or directory in /var/lib/mediawiki/includes/filebackend/lockmanager/FSLockManager.php on line 125

Warning: failed to mkdir "/var/lib/mediawiki/images/lockdir" mode 0777 [Called from wfMkdirParents in /var/lib/mediawiki/includes/GlobalFunctions.php at line 2540] in /var/lib/mediawiki/includes/debug/MWDebug.php on line 300

Warning: fopen(/var/lib/mediawiki/images/lockdir/f00smt22fqj94kquid3mc8ueuj5nipj.lock): failed to open stream: No such file or directory in /var/lib/mediawiki/includes/filebackend/lockmanager/FSLockManager.php on line 125

Warning: failed to mkdir "/var/lib/mediawiki/images/lockdir" mode 0777 [Called from wfMkdirParents in /var/lib/mediawiki/includes/GlobalFunctions.php at line 2540] in /var/lib/mediawiki/includes/debug/MWDebug.php on line 300

Warning: fopen(/var/lib/mediawiki/images/lockdir/f00smt22fqj94kquid3mc8ueuj5nipj.lock): failed to open stream: No such file or directory in /var/lib/mediawiki/includes/filebackend/lockmanager/FSLockManager.php on line 125

Warning: failed to mkdir "/var/lib/mediawiki/images/lockdir" mode 0777 [Called from wfMkdirParents in /var/lib/mediawiki/includes/GlobalFunctions.php at line 2540] in /var/lib/mediawiki/includes/debug/MWDebug.php on line 300

Warning: fopen(/var/lib/mediawiki/images/lockdir/f00smt22fqj94kquid3mc8ueuj5nipj.lock): failed to open stream: No such file or directory in /var/lib/mediawiki/includes/filebackend/lockmanager/FSLockManager.php on line 125

Warning: Cannot modify header information - headers already sent by (output started at /var/lib/mediawiki/includes/filebackend/lockmanager/FSLockManager.php:125) in /var/lib/mediawiki/includes/WebResponse.php on line 37

Warning: Cannot modify header information - headers already sent by (output started at /var/lib/mediawiki/includes/filebackend/lockmanager/FSLockManager.php:125) in /var/lib/mediawiki/includes/WebResponse.php on line 37

Warning: Cannot modify header information - headers already sent by (output started at /var/lib/mediawiki/includes/filebackend/lockmanager/FSLockManager.php:125) in /var/lib/mediawiki/includes/WebResponse.php on line 37

Warning: Cannot modify header information - headers already sent by (output started at /var/lib/mediawiki/includes/filebackend/lockmanager/FSLockManager.php:125) in /var/lib/mediawiki/includes/WebResponse.php on line 37

Coderbynature (talkcontribs)

The permissions on /var/lib/mediawiki/images are drwxrwxr-x. The ownership is stephenw stephenw. The only thing in that directory is a README file.

Coderbynature (talkcontribs)

What should the owner of the images directory be set to? I've Google searched around and got different answers such as www-data or apache. How can I tell which one is the appropriate one?

Coderbynature (talkcontribs)

I should also mention that the jpg file is located on a local drive (D:) of the Windows 7 PC. And both the Windows 7 PC and the Ubuntu server are on the same local network. Samba is also running on the Ubuntu server and the Windows 7 PC can connect to the Samba shares just fine.

Coderbynature (talkcontribs)

RESOLVED: I did the following and I can now upload the image:

sudo chown www-data:www-data -R /var/lib/mediawiki/images