I am trying to create a folder in the app directory but for whatever reason the there is a lock symbol in the folder icon and the user and it's group is www-data.
$folder_path = app_path('core/'.$module);
if (!file_exists($folder_path)) {
File::makeDirectory($folder_path, $mode = 0755, $recursive = false, $force = false);
//mkdir($folder_path, 0777);
exit;
} else {
//
}
When I was trying to create the folder there was a permission denied error so I did chmod -R 777 app/core/ after this when I try to create the user associated to it is www-data.
Why is it www-data and not my username and why is there a lock symbol?
NOTE: Using nginx web server.
As default, nginx and php-fpm will run as user www-data. You can check in your /etc/nginx/nginx.conf and /etc/php/{version}/fpm/pool.d/www.conf
See here if you want to config your web app run as your username.
Related
Hello I am trying to export a word document on Codeigniter project with XAMPP on mac but I cannot solve the permission problem. I know there are many similar questions but I try many things nothing helps. Here is my save method.
When comment the headers part browser show me 4 Errors. Otherwise I can download the file but in text file same errors again printed.
public function saveWord()
{
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
$section->addText('Hello World!');
$file = 'HelloWorld.docx';
// header("Content-Description: File Transfer");
// header('Content-Disposition: attachment; filename="' . $file . '"');
// header('Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document');
// header('Content-Transfer-Encoding: binary');
// header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
// header('Expires: 0');
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$xmlWriter->save("php://output");
}
1.Message: mkdir(): Permission denied
Filename: Writer/AbstractWriter.php
2.Message: tempnam(): file created in the system's temporary directory
Filename: Writer/AbstractWriter.php
3.Message: ZipArchive::close(): Failure to create temporary file: No such file or directory
Filename: Shared/ZipArchive.php
4.Type: PhpOffice\PhpWord\Exception\Exception
Message: Could not close zip file php://output:
Filename:
/Applications/XAMPP/xamppfiles/htdocs/kvkkolay/vendor/phpoffice/phpword/src/PhpWord/Shared/ZipArchive.php
I also try to change folder owner with chown -R myusername:mygroup path/to/folder
for permission chmod -R 0777 path/to/folder
In addtion to I also check the php user with whoami the result is daemon.
In the source code of phpword I can see that they are trying to create a temp folder on this path /var/folders/45/zwgpkpmx3kj0hypypctn67rh0000gn/T/PHPWordWriter_635a3ef3f02cf5.54543358 also try to change this folder owner and permission but it returns not permitted.
Could any one help?
// controller
$file = $request->file('video');
$uri = Vimeo::upload($file, [
'name' => 'test',
'description' => 'easy upload'
]);
return $uri;
file_put_contents(): Write of 207 bytes failed with errno=13 Permission denied
The process running the app needs write permission to the temp directory (defaults to /tmp) for TusUpload to work.
For Laravel $request->file to work, the process also needs write permission to the file directory (this defaults to public/uploads in the root directory of the app, but can be configured)
i am trying to upload image via laravel and then retrieve its url to save in database and return back to the front end application , image upload is working fine at localhost but not at ec2 instance .
Image is uploaded successfully and can be downloaded via filezilla also
i have setup chmod -R 777 for the storage directory in laravel but its still not working
public static function upload_files($type, $file, $id)
{
if ($type == 'profile_pic') {
$image = $file->store('profile_pic','public');
$image = asset('storage/'.$image);
if ($image) {
return $image;
} else {
return false;
}
}
}
it return http://localhost/trip/public/storage/profile_pic/MaHskQD2VcLSlC11VV3agbBNdh7j7k82liewYBw3.png at localhost and when i click on the link, image is loaded successfully
while on my server it loads
http://mydomain/storage/app/profile_pic/MaHskQD2VcLSlC11VV3agbBNdh7j7k82liewYBw3.png and throws 404 not found error
result of ls -lrt is "-rwxrwxrwx 1 apache ec2-user 190916 Jan 23 10:06 MaHskQD2VcLSlC11VV3agbBNdh7j7k82liewYBw3.png"
please run this command on your mydomain terminal:
php artisan storage:link
I'm using beeline to connect to HIVE server.
Logged In user doesn't have access to its default HOME directory.
So after login I'm manually changing the ENV VAR HOME to the location where I have access.
However beeline is not honoring the HOME ENV-variable I've set.
Is there a way that I can set HISTORY FILE location to something else other than /home/{user}/.beeline
Here is a code defining beeline history file location:
/**
* The save directory if HOME/.beeline/ on UNIX, and
* HOME/beeline/ on Windows.
*/
public File saveDir() {
String dir = System.getProperty("beeline.rcfile");
if (dir != null && dir.length() > 0) {
return new File(dir);
}
File f = new File(System.getProperty("user.home"),
(System.getProperty("os.name").toLowerCase()
.indexOf("windows") != -1 ? "" : ".") + "beeline")
.getAbsoluteFile();
try {
f.mkdirs();
} catch (Exception e) {
}
return f;
}
You can only change Hive-beeline history file location by running beeline JVM with -Duser.home=/new/home/dir option.
I get the following error after having deployed my Laravel app to AWS ElasticBeanstalk for the first time. The health check is green. I've changed the environment and database settings to match those on AWS, as instructed by AWS docs.
ErrorException in Filesystem.php line 109:
file_put_contents(/var/app/current/myapp-master/bootstrap/cache/services.php): failed to open stream: No such file or directory
This is at the line 109:
public function put($path, $contents, $lock = false)
{
return file_put_contents($path, $contents, $lock ? LOCK_SH : 0);
}
Try to create /bootstrap/cache directory and set correct permission on it:
chmod 777 -R bootstrap/cache