Mediawiki error: File upload not working - file-upload

I've installed Mediawiki v1.24.1 on my server which is running RHEL7.
I've installed it under /var/www/foohelp/wiki. However, when I try to upload a file, I get the following error:
[f3eae72a] /foohelp/wiki/index.php/Special:Upload Exception from line 1871 of /var/www/foohelp/mediawiki-1.24.1/includes/filerepo/file/LocalFile.php: Could not acquire lock for 'User-default.png.'
Backtrace:
#0 /var/www/foohelp/mediawiki-1.24.1/includes/filerepo/file/LocalFile.php(1174): LocalFile->lock()
#1 /var/www/foohelp/mediawiki-1.24.1/includes/upload/UploadBase.php(738): LocalFile->upload(string, string, string, integer, array, boolean, User)
#2 /var/www/foohelp/mediawiki-1.24.1/includes/specials/SpecialUpload.php(467): UploadBase->performUpload(string, string, boolean, User)
#3 /var/www/foohelp/mediawiki-1.24.1/includes/specials/SpecialUpload.php(186): SpecialUpload->processUpload()
#4 /var/www/foohelp/mediawiki-1.24.1/includes/specialpage/SpecialPage.php(363): SpecialUpload->execute(NULL)
#5 /var/www/foohelp/mediawiki-1.24.1/includes/specialpage/SpecialPageFactory.php(584): SpecialPage->run(NULL)
#6 /var/www/foohelp/mediawiki-1.24.1/includes/MediaWiki.php(275): SpecialPageFactory::executePath(Title, RequestContext)
#7 /var/www/foohelp/mediawiki-1.24.1/includes/MediaWiki.php(584): MediaWiki->performRequest()
#8 /var/www/foohelp/mediawiki-1.24.1/includes/MediaWiki.php(435): MediaWiki->main()
#9 /var/www/foohelp/mediawiki-1.24.1/index.php(46): MediaWiki->run()
#10 {main}
If I edit /includes/filebackend/FileBackendGroup.php
and modify LockManager to
'lockManager' => 'fsLockManager',
and modify permissions as follows:
chown -R apache:apache images/
chown -R 755 images/
I get the following error:
(Could not create directory "mwstore://local-backend/local-public)
I've tried most of the forums and there is no solution that seems to fix my problem. Any help would be appreciated.

Try to set tmp directory:
$wgTmpDirectory = "/var/www/tmp/";
And grant rights:
chown -R apache:apache tmp/
chown -R 755 tmp/
Also try to add global vars:
putenv("TMP=/var/www/tmp/");
putenv("HOME=/var/www");
And if you use imagemagick:
$wgImageMagickTempDir = "/var/www/tmp/";

Related

chown: invalid user: ‘nfsnobody’ in fedora 32 after install nfs

I am install nfs using this command in fedora 32:
sudo dnf install nfs-utils
and then I create a dir to export storage:
[dolphin#MiWiFi-R4CM-srv infrastructure]$ cat /etc/exports
/home/dolphin/data/k8s/monitoring/infrastructure/jenkins *(rw,no_root_squash)
now I could mount this dir with root user like this:
sudo mount -t nfs -o v3 192.168.31.2:/home/dolphin/data/k8s/monitoring/infrastructure/jenkins /mnt
now I want to make a step forward to make it it avaliable to any user from any ip(the client could mount nfs without using sudo), so I first try to chown of this folder:
chown 777 jenkins
and then I want to make this jenkins folder group and user to nfsnobody:
[dolphin#MiWiFi-R4CM-srv infrastructure]$ chown -R nfsnobody jenkins
chown: invalid user: ‘nfsnobody’
and I do not find any nfsnobody content from /etc/passwd. what should I do to fix invalid user: ‘nfsnobody’ problem? should nfs-util added it automatically?
Right now nobody used by default probably after RedHat/Centos versions 8
You can simply use
chown -R nobody jenkins
Or
Change it from /etc/idmapd.conf
[Mapping]
Nobody-User = nfsnobody
Nobody-Group = nfsnobody
To put the changes into effect restart the rpcidmapd service and remount the NFSv4 filesystem:
service rpcidmapd restart
mount -o remount /nfs/mnt/point
On Red Hat Enterprise Linux 6, if the above settings have been applied and UID/GID’s are matched on server and client and users are still being mapped to nobody:nobody then a clearing of the idmapd cache may be required.
# nfsidmap -c

Change the ownership (chown) from 'root' to 'apache'

System OS: CentOS7.0-64 LAMP for VSI
Problem:
I am attempting to change the ownership of two virtual directories from 'root' to 'apache', so that Apache can read and write data. I am using the following commands but to no avail.
chown -R apache:apache /var/www/html/www.example-virtualhost1.com
chown -R apache:apache /var/www/html/www.example-virtualhost2.com
When entering these commands I am receiving an error 'command not found.' Any reference material would be greatly appreciated.
Best.
In order to change the ownership, try the following line:
sudo chown -R apache /var/www/html/
or
sudo chown apache /var/www/html/www.example-virtualhost1.com
The structure is as follows please note the parentheses as an attempt to explain each piece of the command:
sudo(run the command as root) chown(command to change ownership) -R(recursively change everything within the folder) apache(who you want to be the new owner) /var/www/html/(the folder you would like to modify ownership)
Once you have ran this command, you should be able to type in the following command:
ls -lr
That command will show you who has ownership.
I hope this helps!

Permission Denied error for Vagrant

I made the mistake of once running "sudo vagrant up" and now whenever I run "vagrant up" it gives me the following error
==> default: Running cleanup tasks for 'chef_solo' provisioner...
/opt/vagrant/embedded/gems/gems/vagrant-1.7.1/lib/vagrant/environment.rb:492:in `initialize': P Permission denied - /Users/mkv/.vagrant.d/data/lock.fpcollision.lock (Errno::EACCES)
I've tried deleting the .vagrant folder and also the Cheffile but I always get the same error.
What can I do to sort this out?
The issue is related with permission which you accidentally run the application with root.
Follow the steps:
Delete /Users/mkv/.vagrant.d/data/lock.fpcollision.lock and run vagrant up again.
Find any files are owned by root under /Users/mkv, include hide files. if found, change it back to your own user account.
You can run below command to find out files owned by root
find /Users/mkv -type f -user root -print
For those who wonder how to change a user to your current one, using find command:
sudo find ~/.vagrant.d/data/lock.fpcollision.lock -type f -user root -exec chown $USER {} \;

CakePHP based application installation error: 777 permission directory is not writable?

Trying to install my CakePHP based application on server, but got following error:
Warning: _cake_core_ cache was unable to write 'cake_dev_en-us' to File cache in /var/www/html/cakephp-2460/lib/Cake/Cache/Cache.php on line 325
Warning: /var/www/html/tmp/cache/persistent/ is not writable
Sounds simple, but it is not - because my 'persistent' directory IS writable - in fact, /tmp and it's sub directories are writable.
Can you point me where is the problem? Do I missing some of PHP modules on server, or something like that?
Is there something to do with SeLinux?
Check that the user group for that directory is correct.
Maybe the user owner group does not have root permissions and therefor cannot write.
you may need to do the following on your server:
chown root:root -R /path_to_cake/app/tmp
Yes it is the problem in your SeLinux.You have to set www/..path../tmp directory is a httpd_cache_t so opan your terminal and
list to see all httpt_cache_t in system
# semanage fcontext -l | grep httpd
Set your www/.../tmp directory
# semanage fcontext -a -t 'httpd_cache_t' 'www/..path../tmp(/.*)?'
# restorecon -Rvvv /path/to/wwwroot/cache

~/.ec2/id_rsa-gsg-keypair not accessible: No such file or directory

I'm trying to launch a Hadoop cluster on Amazon ec2, using the instructions in "Hadoop in Action" (also here: http://wiki.apache.org/hadoop/AmazonEC2).
I've set up my private ssh key and configurations, but when I try to launch a cluster using the command-line tools:
hadoop-ec2 launch-cluster test-cluster 2
I repeatedly get this error:
Warning: Identity file ~/.ec2/id_rsa-gsg-keypair not accessible: No such file or directory.
Permission denied (publickey,gssapi-with-mic).
The ~/.ec2/id_rsa-gsg-keypair definitely exists, though, and I did chmod 600 it:
> chmod 600 ~/.ec2/id_rsa-gsg-keypair
> ls -l id_rsa-gsg-keypair
-rw------- 1 my-username
Any idea what's wrong?
You may have already realized this, but the problem is possibly related to the ~/ path usage. Try using the absolute path /home/username/.ec2