php upload_tmp_directory not work - php

hi am getting serious issue when i upload image i get error from uploader missing temporary folder. i search the internet and use this code ini_set('upload_tmp_dir','/sub_domain_home/folder/tmp'); but this not work. then i echo the directory of tmp image upload i use this code sys_get_temp_dir(); i get empty result. i need help how can i fix this issue ? because my default tmp folder not work properly. after when i remove my server home directory default files and folders.
SOLved
i contact to my server provider and tell him to all details and info what i do for solve this issue. they answer me we don't saw any issue we change ur server if you want ? and i agree then thye change my server after 10 hours i check my website my issue solved and all works fine. uploading etc.

why did you delete everything in /home ? I assume you are using linux?
Do this:
do a phpinfo() on a test.php to see where your php.ini is located
Stop using ini_set, sometimes it does not work properly
Set a temp dir in the php.ini
Create above temp dir (or make sure it exists) and chmod 775 or something so you can test properly if it's working
Check phpinfo() again to see if the tmp dir has taken effect.
Stop deleting files you think you don't need before reading about them online

Related

Not being able to delete file from local storage using PHP

I am using PHP. I have a file in local storage of Xampp. I have been trying to delete that using unlink. I tried copying the relative path and pasted in unlink, but it does not delete the file from local storage. I even tried pasting the path, so not the relative one, but it still does not delete the files. Can someone reckon what I might be doing wrong?
My code:
unlink("userdir/username/181");
As someone mention in comments I try changing the permission. I tried sudo chmod -R 755 /Users/hemlatamahaur/.bitnami/stackman/machines/xampp/volumes/root/htdocs
but it still says Operation not permitted. What shall I do?
this code working for me!
// first check location exist or not
if (file_exists(#locationfile)) {
unlink(#locationfile);
}

Upload file returning “Missing a temporary folder”

I have my site hosted on GoDaddy and on that site I have a part for uploads, it worked fine until days ago, now it started to return error 6 - Missing a temporary folder for any file I try to upload, I tried several ways to solve it, changing the php.ini and still nothing.
In my PHP file if I use the command file_exists(sys_get_temp_dir()); returns me true, so the folder is there.
If I use the is_writable(sys_get_temp_dir()); command returns me false, maybe there is the problem, but the folder /tmp on my server has permission drwxrwxrwt.
If anyone can help me with this problem, since I followed several tutorials and nothing about the solution.
Some providers do NOT grant access to the initialization file for PHP, but rather customers must use a local php.ini file with only the entries needed and allowed to set in a customer account.
In the server's Site Administration menu -> Server -> PHP Info what does the output show for upload_tmp_dir?
More than likely on a shared host, one cannot access edit the main php.ini, but one can set some things via their own local (in their account) php.ini file with the right 'snippets'.
Good luck, hope this helps.
Well, the problem has been solved and it is more strange than I imagined, I will leave the answer here to help you if someone has the same problem.
It was necessary to execute the command chmod 777 / tmp, but this command could not be executed since it gave an error that the folder was read-only (Ready-Only file system). To resolve this, it was necessary to mount and remount it, but I couldn't do it either, as it wouldn't let me remount the /tmp folder
For another reason I had to restart the server and magically the server let me change the permissions to 777 (from drwxrwxrwt. to drwxrwxrwx.). With that problem solved.
I thank everyone who tried to help.

PHP file not working on hosting

So this is what's happening. I don't know how to explain this.
I made a software which uploads file to my website's FTP location. It's working as it should.
As you can see in the folder that inside public_html/phphostrot.rviews.xyz/user_rot/ there are 2 php files. But when i visit the url http://phphostrot.rviews.xyz/ i get a blank page with inder of / and nothing else. And if i try to access http://phphostrot.rviews.xyz/user_rot/ I get 404 error. Even the link to the file is not working. I don't know what's the problem.
I think it's a issue with the file permissions. Have you configured your server to serve files from your public directory.
Try changing the ownership of the files to www or apache
app, img, wp-admin, wp-content, wp-includes?
check file permissions (+x), as #atefth said, check owner.
check webserver config. and check apache/nginx logs

Joomla tmp folder not writable? or open_basedir troubles?

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.

Wordpress Error: A TimThumb error has occured

I've encountered an error after installing wordpress onto a new domain.
I've contacted the theme developer and have had no luck resolving the issue.
I receive the following error when i copy the image link:
Warning: touch() [function.touch]: Utime failed: Permission denied in /home/domain/public_html/wp-content/themes/folioway/core/thumb.php on line 190
Warning: Cannot modify header information - headers already sent by (output started at /home/domain/public_html/wp-content/themes/folioway/core/thumb.php:190) in /home/domain/public_html/wp-content/themes/folioway/core/thumb.php on line 413
A TimThumb error has occured
The following error(s) occured:
Could note create the index.html file.
Query String : src=/wp-content/uploads/2012/03/CoffeetabeBox-custom_web1.jpg&w=187&h=187&zc=1&q=90
TimThumb version : 2.8.2
I have not modified anything else aside from some CSS.
The thumbnails do not appear on the pages, however, the images do appear in lightbox.
I have set the permissions to the cache folder to 777, but this has not resolved the issue.
Any help would be greatly appreciates. Thanks.
It happened to me too, and this is the second time!
If you don't have time to discover why, but you want to keep it working, just rename, or delete your /cache folder; then, create a brand new /cache folder, set permissions to 777, and it will work again.
I found that the cache folder this is referring to is the one within the same folder as timthumb.php - find that file and the related cache folder and give the cache folder 777 permissions.
if you are on a linux based server,
first find the FILE_CACHE_DIRECTORY from the config file by (ex. in linux server open the file in vi commond)
vi /system/web/esupu/wp-content/themes/gadgetry-parent/framework/timthumb/timthumb-config.php
it could be like
define('FILE_CACHE_DIRECTORY', '../../cache/');
SO we change the cache folder ownership to user "www-data" which is the default user for Apache web server which runs this php codes,
sudo chown -hR www-data:www-data /system/web/esupu/wp-content/themes/gadgetry-parent/cache/
also, now better check if folder can be writable too (chmod permissions to 777)
Instead of using 777 as others have suggested, use 755 to the /cache folder.
I just delete the cache folder and refresh the page where code was, it started working.
I think it is the problem of file permission.
Headers already sent is usually a symptom of whitespace either at the beginning or the end of the file - check timthumb.php and make sure you have no blank lines or space either before the
The other possibility is that /wp-content/uploads/ is not writable by the web server, but I'd bank on the first one being the cause.
I added this to a php.ini file:
display_errors = Off
display_warnings = Off
output_buffering = On
TimThumb is a separate open source project that is used by many WP plugins.
If updating folder permissions doesn't work for you, another solution which worked for me was to update the plugin's TimThumb script with the most recent version. You can download it here:
https://timthumb.googlecode.com/svn/trunk/timthumb.php
In my case this file was in wp-content/plugins/events-manager/includes/thumbnails
For others that have this issue when using the FiatLux Wordpress Theme, as I am here is the solution:
Open FTP like Filezilla
Navigate to yoursite/wp-content/themes/fiatlux/includes*
Delete the cache folder
Recreate the cache folder, with permission setting 755
Download the updated timthumb.php file from GitHub and replace (I renamed the old one timthumb.old to test
If you use a Media server/ CDN, then be sure to add that site to the $ALLOWEDSITES array in TimThumb.php file
*If using another Wordpress theme, then find the TimThumb.php file and corresponding cache folder in that theme/ plugins folder in wp-content
in
src=/wp-content/uploads/2012/03/CoffeetabeBox-custom_web1.jpg&w=187&h=187&zc=1&q=90
try put a '?' between .jpg and &w, so it will be like this
src=/wp-content/uploads/2012/03/CoffeetabeBox-custom_web1.jpg?&w=187&h=187&zc=1&q=90

Categories