Joomla tmp folder not writable? or open_basedir troubles? - php

i'm working on this joomla site and im not able to upload any extension. if i use normal upload method i get JFolder::create: Could not create directory
Unable to create destination
if i use upload from directory i get Copy failed
JInstaller: :Install: Failed to copy file
i have tried so many solutions found in joomla support forum but none worked for me.
in desperation i even changed tmp ermissions into 777 and now directory permissions (i know its bad) list shows that tmp is writable but show the warning The PHP temporary directory is not writeable by the Joomla! instance, which may cause issues when attempting to upload extensions to Joomla!. If you are having issues uploading extensions, check the '/tmp' and set it to be writeable and see if this fixes the issue. in extensions manager-> warnings
i was wondering whether open_basedir in defect. In my php info file i have
/srv/www/vhosts/domain/httpdocs/:/tmp/ - no value . how can i know open_basedir is in defect? and how can i solve this extensions matter?

The problem may be because upload_tmp_dir isn't set in php.
Look in SITE > SYSTEM INFORMATION > PHP INFORMATION and check if upload_tmp_dir has been set. If not, you need to edit php.ini
On our servers (which use open base dir), the setting is:
upload_tmp_dir=/tmp
This value could be different for you, depending on your server configuration.

Set permission to 777
use full path for logs and tmp e.g.:
/var/www/vhosts/mydomain/httpdocs/tmp

In the Joomla Backend, go to:
Site >> System Information >> Directory Permissions
and see if the "tmp" folder says "Writable"
I had the same problem with one of my shared hosts. The issue was that even though I had set literally everything to 777 (purely for testing purposes), I didn't have file ownership. If this is the case for you too, then you will have to talk to your hosting provider.

Related

move_uploaded_file permission denied / changing upload_tmp_directory

I've done this before on shared servers, but this is not working with my dedicated server. Basically, I am trying to upload some image files with a simple php script. As the title suggests though, I am getting an error when I try to move the files with move_uploaded_file(), and of course the rest of the application fails because I have no images to process - I'm pretty sure the images never make it to the temporary directory because the permissions won't allow it.
Anyway, I have been trying to change the tmp directory to some other directory where there should be appropriate permissions by editing the php.ini file, but after dozens of attempts I still see "/tmp" (the default) when I echo sys_get_temp_dir(). I have added this line to php.ini: upload_tmp_dir ="/var/www/uploads". I cannot figure out if the path is incomplete or incorrect (the "uploads" directory does exist). I have tried other variations of this, but I just cannot figure out why it's not changing.

Joomla 3.4.4. tmp directory

I have problem with installing any extensions in Joomla! 3.4.4.
When I try to install any i have error
An error has occurred.
-1 Copy file failed
I set all CHMOD for 777 (for tests) in configuration.php there is correct path to tmp directory. One thing that is strange is info in joomla backend:
The PHP temporary folder is not set. The PHP temporary folder is the
folder that PHP uses to store an uploaded file before Joomla can
access this file. Whilst the folder not being set isn't always a
problem, if you are having issues with manifest files not being
detected or uploaded files not being detected, setting this in your
php.ini file might fix the issue.
I don't have access to php.ini so i can't use upload_tmp_dir . When i try make my own php.ini file and then make rule in .htaccess nothing happens. Maybe someone had the same problem?
Set the directory to 755 firstly. No need for 777.
Make sure the directory is linked via the home i.e.
/home/your_user_account/public_html/tmp
And also then check your hosting package has not run out of diskspace.
These are the common problems.

Error uploading images with mediawiki (on Directadmin)

I've installed mediawiki on my webserver (with directadmin), but I'm having trouble enabling the uploading of images (a .jpg in this case)
I've set $wgEnableUploads = true; in the settings and checked that the images folder is writeable (it's set to 755). But when I try to upload a test image called testimage.jpg I get the error:
Could not store file "/tmp/phpjNV3oh" at "mwstore://local-backend/local-public/1/13/testimage.jpg".
Since I'm on shared webhosting and only have acces to the directadmin interface I can't set the owner of the images folder (which is an answer here). I've tried setting the folder to 777, and that doesn't change anything either.
Does anyone know what the problem is? Could it be that I'm using cloudflare? Also, why is the url returned in the error (mwstore://local-backend/local-public/1/13/testimage.jpg") not a normal url (like mysite.com/wiki/images or something)?
I had this problem twice on shared hosts, and there were two solutions for me.
One:
Set $wgHashedUploadDirectory = false on LocalSettings.php, then try to upload another file.
Doing this all your files will be uploaded to $wgUploadDirectory, /images/foo.jpg instead of /images/x/xx/foo.jpg
Please note that if you change this now, you should not set it to true in the future, else you will need to manually move your files into the hashed directory structure.
Two:
Contact your host's support service
When i emailed the situation to my host's support service, they replied that all folders inside /my_wiki/images were owned by root instead of apache-user, and since i couldn't chown they did it.
You need to set the proper security context type so that SELinux stops complaining.
sudo chcon -R -t httpd_sys_script_rw_t /var/www/mediawiki123/images/
Don't forget to set the directory back to the correct permissions.
sudo chmod 755 /var/www/mediawiki123/images/
For all of your SELinux needs, browse through here.

Realpath() warning joomla php

I have created a php file that exports data to an excel file using PHPExcel.
On my localhost everything works fine but when I upload it to the live site I get :
Warning: realpath() [function.realpath]: SAFE MODE Restriction in effect. The script whose uid is 755 is not allowed to access /tmp owned by uid 0 in
I'm not sure if I can fix this with a simple CHMOD or I have to call my server administrator
I am using joomla 1.7.1 if it matters
Thank you
Sounds like 'safe mode' is restricting access to a folder. You need to either disable safe mode or add the folder to the allowed directories. Someone with a similar problem here < http://forums.gplhost.com/phpBB2/image-vp8763.html> .
I suggest you look at your server logs for a more detailed error.Look for instances of open base dir error messages.

Can't Upload File on IIS

I am on a shared-hosting account with GoDaddy it's a windows Server and I am getting this error when attempting to upload a file:
Warning: move_uploaded_file(D:\Hosting\6903\html\pdfs\ALDOmypdfAP.pdf) [function.move-uploaded-file]: failed to open stream: Permission denied in D:\Hosting\6903\html\back.php on line 436
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'D:\Temp\php\php98C.tmp' to 'D:\Hosting\6903\html\pdfs\ALDOmypdfAP.pdf
I have heard that I can set my php.ini file to change the directory that it's immediately being uploaded to, which would work, however I can't access my php.ini file.
I have tried to create my own php.ini file in the root of my directory, and it causes all sorts of problems, such as not finding the correct MySQL configuration files, goDaddy's support on this was to remove the custom php.ini file, ridiculous, I know.
I have tried to use ini_set like this
ini_set('upload_tmp_dir', 'D:/Hosting/6903/html/pdfs/');
But it hasn't made any effect. Do I have any other options here? Thank you!
UPDATE: From Coda the Octal permissions read 777 of the destination directory.
As far as I know, you need to give the IUSR_MACHINENAME account write permissions specifically on the folder that you are trying to write to, or else it will fail. I don't know what Coda is, but can it allow you to set permissions for specific users?
Had the similar problem.
Fixed it by giving all permissions to usergroup "Authenticated User".
It took me couple of hours to realize it. This post kind of gave me the hint.
I hope my share will help others.
Maybe this can help...
Find and open php.ini in PHP folder (In my case c:\Program files(86)\PHP)
Search for upload_tmp_dir word and do one of two posibilities
--Posibility 1
3.1 Set upload_tmp_dir = "[Some folder with full permission for IUSR user]"
--Posibility 2
3.2 Search in windows explorer for the folder that is setted in upload_tmp_dir (In my case C:\WINDOWS\Temp)
3.2.1 Right click on C:\WINDOWS\Temp -> Properties -> Security -> Edit button -> Add, then add IUSR user and set full permissions to this -> Accept button.
I think this can help someone.
The problem probably comes from the final destination directory more than the temporary directory.
Normally, if the file cannot be uploaded at all, $_FILES['yourfile']['error'] will be set to UPLOAD_ERR_CANT_WRITE (7). From the error message, it tells us the problem is that move_uploaded_file can't either read from the temporary directory (unlikely), or write to the destination directory (most likely).
Check and maybe try changing the permissions on the destination directory.

Categories