Apache cannot access folders in my home directory - php

I am getting this error
Warning: include(/home/me/some_folder): failed to open stream: Permission denied in /var/www/html/my_web.php on line 6
I have tried modifying permissions like this
chown apache /home/me/some_folder
chmod 755 /home/me/some_folder
I still cannot get in! What am I doing wrong?
EDIT
I am running an instance of linux with apache

You have to give access to all files in /home/me/some_folder
chown -R apache /home/me/some_folder
chmod -R 755 /home/me/some_folder

I got it to work by
chmod 755 /home/me/
I snuck around online a bit more and found an answer to a similar question on CentOS, and tried it
If someone could explain why, or security behind this, that would be greatly appreciated
Thanks for your help

Related

Is this issue related with Laravel? i don't know much about it

Today i went to my website and this what i found.
And i'm really confused right now, is anyone familiar with this problem?
you need to run the below command on your server:
sudo chown -R www-data:www-data /var/www/html/projectpath
if you only want to give permission to storage folder then run below command:
chmod 775 /var/www/html/projectpath/storage
Hope you got your answer.
This issue is not at all because of laravel.
It is occurring because there is no permission given to your storage folder to open the file.
So you need to give permission by using below command:
sudo chmod 777 /var/www/html/projectpath/storage
777 command means you're giving all the permissions like read write open and making it accessible.

apache/php symlink 403 permission forbidden

I have my project sitting in: dev/php/project.
My system apache2 server folder is: /var/www/html/.
And my goal is to reach this address: localhost/project/file.php.
So I have created symlink in /var/www/html folder like so:
sudo ln -s dev/php/project /var/www/html/project
and after this if I try to open localhost/project url. I get 403 forbidden error. I searched alot and saw that others have had same issues. So I tried to follow how to fix guides and none of them helped.
All of the guides say that I should chmod the symlink, but when I try to excecute this command:
sudo chmod 0755 -R /var/www/html/*
or directly:
sudo chmod 0755 -R /var/www/html/project
I get:
chmod: cannot operate on dangling symlink '/var/www/html/project'
I have also tried to use other chmod modules ( dont know how to call them correctly, sorry) like 777, x+o, and everything I came across . I also tried to create symlink with one php file but the outcome was the same.
Can someone please help me understand what the problem is? I cant move forward because of this issue. I am ready to quickly respond to answers, questions.

How to allow www-data apache user to use mkdir() php function?

I'm trying to create folder using mkdir($pipeline_dir, 0777, true);, but get the error: mkdir(): Permission denied.
I'm using apache2 on ubuntu 14.10 and php 5.5. I have already set up 777 permissions to all files and folders of my project recursivly (sudo chmod -R 777 myproject).
Also I've tried to change user to www-data (sudo chown -R www-data:www-data myproject).
Setting 777 permissions on folders is a bad idea.
Since you are still getting the error, somewhere the permissions are still wrong.
Try var_dump on the $pipeline_dir and make sure the web user has permissions to write in that parent folder.

file_put_content...fail to open stream:Permission denied in Laravel 5

The error is mention in below:-
ErrorException in Filesystem.php line 81:
file_put_contents(/var/www/html/Training-management-system/storage/framework/views/bcb68ba8b65b7fabca5fe88709fb00b6): failed to open stream: Permission denied
I can google itbut not get the exact solution. SO I am thankful if anyone help me to solve it out.
is a file permissions issue as lesssugar said , you need to give writte permissions to the storage folder , so go to your html/Tranining-management-system.. folder an then you can do :
chmod -R 0777 storage/
That will change to writte access Recursively .
Please read the configuration section in docs :
http://laravel.com/docs/master#configuration
You have to do the same with the cache folder.
I run php artisan view:cache and it solved the issue
This is an error with the view file cache. Please run php artisan view:cache
I had the same issue with Laravel running in a docker container. I checked and the www-data group didn't had permissions nor ownership on the directory.
The chown command allows you to change the user and/or group ownership of a given directory.
chown -R www-data:www-data storage/
Keep in mind that chmod -R 777 storage/ permissions is a massive security risk. Normally users outside www-data group should not be able to manipulate files. This is just a workaround for development environments and should be avoided on production environments.
I tried many solutions but didn't get resolved this error.
Just: I have just created views folder in 'storage/framework' and solved it.
I have this problem multitime ,first use bellow code in terminal linux:
chmod -R 0777 storage/
If it is not work use write and exec php artisan view:cache
in terminal
Or you can remove existing files in storage/framework/views directory
I managed to fix it as I was only granting permission to via this command:
Copy Code
sudo chmod -R 775 storage/framework/views
The fix was to add this:
Copy Code
sudo chmod -R ugo+rw storage storage/framework/views
I try run php artisan view:cache and it solved this issue

Why getting Permission Denied error while using mkdir with PHP on XAMPP Linux

I'm using XAMPP on my CentOS server. I just wrote a simple file upload script with PHP but there is a problem using mkdir() function, because of the error below:
Warning: mkdir(): Permission denied in /opt/lampp/htdocs/script.php on line 10
Also I can not use move_uploaded_file, because of the same problem.
How can I fix this issue?
You need to give permission to your web server or www folder like this, here www-data is apache group and user, make sure you have one apache user and group.
chown -R www-data:www-data /path/to/webserver/www
chmod -R g+rw /path/to/webserver/www
In your case
chmod -R g+rw /opt/lampp/htdocs

Categories