Unable to rename file in tmp folder in Symfony 2 - php

I have changed the permissions of tmp folder to 0777 but still Symfony is throwing a permission error :
rename(\/tmp\/__CG__MyEntity.php.55eab1cb8bee30.16966444,\/tmp\/__CG__MyEntity.php), operation not permitted.

Related

APACHE Permissions are all set but still don't have permission

I recently faced this issue, as you can see in the picture, I granted all sorts of permissions to all files, but still I get this error.
Here's the code:
$zipdir=dirname(dirname(__FILE__)).'/tmp';
$zipname="$zipdir/$input[user]-".time().'.zip';
list($pdf,$pdfname)=test_pdf($request);
$zip=new ZipArchive();
if ($zip->open($zipname,ZipArchive::CREATE)!==true) return $error='Could not open zip archive for writing';
$zip->addFromString("pdf/$pdfname", $pdf->Output('','S'));
$zip->addFile("test-docs/",$testformname);
$zip->close();
if (!file_exists($zipname)) return $error='Could not create zip archive';
https://i.stack.imgur.com/kmxUg.png
And here's the log:
PHP Warning: ZipArchive::close(): Failure to create temporary file: Permission denied in /var/www/html/test/app/test.php
Problem just solved!
I needed to grant 775 or above permission to the whole "html" folder in this path :
"/var/www/html/..."
Not just files and folders in it because i tried that completely.
Also apache:apache permission is not needed, root does the work.
This comment helped a lot:
move_uploaded_file gives "failed to open stream: Permission denied" error

permission denied : copy / writing file (laravel / php)

I use on my application some fonctions about files. creation of files, copy/create from a directory to another, update. On my localhost, all is okay, that's work.
The main purpose is to have a manager for translation on the website.
rights of parent directories : 755
I have error :
1) if files doesn't exist the error is
copy(/blabla/path.php): failed to open stream: Permission denied
2) if I create files before (touch + chown on usr:usr) with basic rights (644) or with updated rights (775) :
file_put_contents(/blabla/path.php) : failed to open stream: Permission denied
On my localhost :
right of directories : 755
right of files : 644
I also tried to clean php cache (php artisan cache:clear)
edit :
I use 2 functions :
copy (who copy default translate file in the directory of second langage) and file_put_contents (who edit file)
public function replaceSlugs(Array $slugs,$filename, $lang)
{
$file=$this->path2File($filename,$lang);
if(!file_exists($file)){$this->duplicateFile($lang,$filename);}
$translate="<?php return ".var_export($slugs,true).";";
return file_put_contents ( $file , $translate, LOCK_EX );
}
private function duplicateFile($lang,$filename)
{
copy($this->path2File($filename),$this->path2File($filename,$lang));
}
private function path2File($filename,$lang="en")
{
return resource_path('lang/'.$lang.'/'.$filename.'.php');
}
Solution is Risky but it will do the trick
Give your folders full permission & clear Cache
Something like this.
sudo chmod -R 777 public/lang/en
if you don't give 777 permission you will also stuck while unit Test.

How write in files through TYPO3 Command Controller

I wanna create files and write in log file through a TYPO3 command controller. I have used command controller, this is registered in ext_localconf as $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers'][] = VENDOR\ExtName\Command\GeneradorArchivosEncuestasCommandController::class;; the objetctive of this command controller is to create all templates in xlsx of a surveys of my extension domain, but in the mopment to create a file or write inside log files, I have the next error: failed to open stream: Permission denied.
Otherwise, the directories has 775 permissions and owner apache as group; and the users: _cli_lowlevel and _cli_scheduler, those user have the same file mount in BE referenced to typo3temp.
I am using TYPO3 7.6, PHP 5.6, Apache 2.2.15

Destination not writable on Fedora 17 using php

I am using Zend Framework to upload files and am getting a destination not writeable error EVEN THOUGH the directory is chmodded 777
$adapter = new Zend_File_Transfer_Adapter_Http();
$path=APPLICATION_PATH."/tmp";
// die($path);
$adapter->setDestination($path);
Following is the directory tree
/var 755
/www 755
/attendance 777
/tmp <-- writeable 777
This is a really wierd error. In the past, after chmodding, the error generally went away. This is a local server(Fedora 17)
PHP Version 5.4.17
Apache/2.2.23 (Fedora)
php safe mode is off, atleast there is no entry in config files, nor could I see it anywhere in the phpinfo();
I've been trying for 8 hours, but no cigar, not even a Dunhill

Kohana Logs file writable but permission denied

I have checked the install.php and it gives me the green light on the logs file. However, my application gets an error saying
ErrorException [ 2 ]: file_put_contents(/my/app/path/logs/2013/03/04.php): failed to open stream: Permission denied ~ SYSPATH/classes/Kohana/Log/File.php [ 90 ]
I am also faced the same issue,i solved it with help of below comment to make all sub directories writable.
chmod -R 777 cache/ logs/
This may help future referrer.
Even if logs/ directory exists and have proper permissions set, it's subdirectories (like logs/2013/ and logs/2013/03) could have improper permissions, for example due to some file copying or so...
Be sure that all subdirectories allow writting for user/group/other.

Categories