ErrorType:
Warning: Unknown(somephpfile.php): failed to open stream: Permission denied in Unknown on line 0.
I wonder who writes error messages for the PHP development team. Some state-of-the art professional or a poet!! Only he can understand what this error means.
Solution:
When my php script threw the same message, I looked into the file permissions of this file and saw that it had only read/execute permissions for the owner. This error disappeared when I gave permissions for Group and Everyone.
(Note: There are different kinds of Permission denied error in PHP. Your problem might not be due to this reason. However, it doesn’t hurt to look into the permissions of the corresponding file. If you think that I could help, please leave a note here.)
Thank you so much for this… I ve been looking for this solution for 2 full days! Also reconsidered reinstalling Ubuntu with the Server option!
Just installed Apache Php Mysql in my Linux Fedora Box a while back, and ran into the same problem. So, I googled and found this page. A life saver! Thanks.
Thanks too this made me use xp instead of My Ubuntu for PHP for a day
The answer i was looking for.
Thanks
Thnx very much for that solution… that’s perfect! Good work!
Thanks, I think I wouldn’t think of that one… Thanks… lost one day fixing this trouble….
I have been having this problem for at least one week and my effort has gone in vain.
I’ll see if it is the file itself that need chmoding as the folder is ok.
I think I’m saved.
Thanks a lot!
Gracias, problema solucionado
I did resolved the problem too. My files needed chmoding. Thanks again!
Ohhh gosshhh!! It works!! 🙂
thx millions 😀
Thank you!
Just installed ubuntu LAMP box (no gui). Installed phpmyadmin, then sent some files from my Windoze machine only to get this frustrating error message.
Did a chmod -R (my web directory) 777 and everything’s fine! 🙂
Thank you again!!!
Ran into this problem and you made my life easier. Figured I’d leave my mark to show just how useful your little explanation is as it continues through the years!
Life saver , if the error was just a little clearer it would have been an easy fix.
Thanks. Really worked for me.
In my Ubuntu you have to write it like this:
chmod -R 0777 my_web_directory
Thanks this helped! spent too much time trying to figure it out, this may be obvious to everyone else, but wasn’t to me, so it might be worth mentioning, but you may also have to change the permissions of the files themselves if they were put in before the folder permissions were changed.
Arrghh 😉 I had this problem in the past, but I forget what was the solution and of course that problem occured again. But this time I found your post. Thank you very much.
Just gonna throw it out there, in a multi-user environment, or any server on the internet, using 777 permissions on all of your files is a bad idea, unless you actually want everyone reading and writing all of your files. I would look into changing ownership and/or the group of the file first for security reasons.
Thank u very much for the post…
You are a saviour man i’ve been on this for more than 12 hrs everything was setup and i was wondering why is the page not loading.
finally i set the permissions and the phpinfo page loaded.
thanks bro
Hi…
I Don’t know who wrote this soluton.Anyway it helped me a lot…For me this error message appeared suddenly..and when I change the permissions it worked..Thanks a lot
This fixed my problem; Thank You!!! Merry Christmas!
Thanks for pointing out the solution to this particular error.
I’ve been having this error with PHPMaker 6-generated scripts but with your (easy) fix, everything is now running smoothly.
You saved my life…. I was going nuts … thanks man!
I think the problem is that the file should have atleast 0444 permission meaning atleast read permission for others. if the file does not have read permission for others you won’t be able to run your scripts. However, you do not need to apply 0777 permissions only chmod 0444 should work. Thanks again.
I used chmod a+rw info.php and then it worked.
Thanks!
Correction:
I used chmod a+rx info.php
I Was really starting to get annoyed with the error!
Many many thanks for the valuable help…
Cheers
You sir are the master … thank you. Stupid error message.
Why is the error message stupid? The file permissions are wrong and it gives this error message when PHP doesn’t have permission to read the file. How is PHP supposed to give you specific error details when it has absolutely no way of reading the problem…
I must have set my index file to 0200 during my sleep or something. Strange.
Thank you for the solution. Kind of hard to figure out actually.
Thanks a lot! This saved me from a lot of trouble.
I feel as thick as bricks, but yea it works.
I was sure I had chmod a+rx, but must have forgot to press enter 🙂
I did upload php file using a ftp client, I did overlooked the uploaded file permissions as I thought it will be 0644 by default, but after I read this, I did check and found that it was uploaded with 0600 permission. it worked after changing permissions to 0644, thank you
Thank you for your explanation. I was stunned by the inexpressive error.
Now all is well.
Cheers
I had this problem and my permissions were fine. Checking /var/log/messages revealed that SELinux was preventing my file from being accessed by apache because it was mislabeled. Running the following command on the offending file solved my problem:
chcon -t httpd_sys_content_t myfile.php
This happened when I created a php file in my home directory then moved it to my docroot. To see the labels of any file, use
ls –scontext
Hope that helps.
Thanks Mate.
You saved my life.
Thanks for the quick fix, I was skeptical about permissions too. Plus, it threw error about “function.include not found” and I started looking for errors in the code and started find command to look for function.include file.
Hey, I’m using Xampp on MAC as my server and get the same error. I can’t seem to find anything about permission anywhere on this. Can you please enlighten me and tell me where to go and what to do.
Thanks alot!!
Thanks a lot! Quick solution for annoying error 🙂
Thanks a lot. It really helped
Thanks for the solution, understanding this helps to move along the PHP learning curve!
Thanx a lot!
Thanks a lot!
You really help me out! 😀
I thank God for the answer i got from this site. May God bless you. I have been in this error for more than 2 weeks. Thank! for the solution you gave me
Command:
sudo chmod -R 777 /var/www
that works fine, 😀
Oh, people… please…. it’s 2010. Making an entire webroot world-writable is such a dangerous thing to to do. It just invites defacement and malicious file hosting on your servers.
Do it the right way:
chmod -R +X,u+rw,g+rx,o-rw,a+rx /web/directory/root
This will give you (safe) perms like this:
drwxr-xr-x. 2 owner owner directory
-rwxr-xr-x. 1 owner owner script.php
But, dir permissions are not what are causing me to get this error.
Thanks a lot.
I’ve been working on this problem for a week until i found this thread.
Now it occurs to me that i made the file on a windows system and transferred it to Mac. So Mac users didn’t have the permissions.
Thanks thanks thanks
If you are a real estate professional, be really careful in dealing with KoRes Corp. in Weston Florida. Tulio Rodriguez & Monica Cataluna-Shand are shysters and look for anyway to steal ones customers. They attempt to steal your client by requesting their contact information and later contact them behind your back to get them to deal with them directly.
Its ok that my name will appear at bottom of the page, still thanks for this solution. 🙂
Haha. very true!
But thanks for that info. Was stuck with that cryptic error message for sometime now.
I thought it was because of my upgrading apache.
Fixed my problem too! Thanks!
It worked. Thx.
Thanks. saved lots of time!
I just want to point out you have a spammer on your blog by the name of “Ontothempoper”. Also, great solution. Unfortunately I do not have administrative access to the server so this pretty much renders this solution useless unless I ask the admin to grant permission.
Hey, Thank you so much.
This has solved my problem too…
“Little things, great effects”
This has solved my problem too…
Tnx’s
Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0
Fatal error: Unknown: Failed opening required ‘C:/xampp/htdocs/sand_box/databases.php’ (include_path=’.;C:\xampp\php\pear\’) in Unknown on line 0
Yep, that was it.
Wish I could have found this sooner! worked like a charm. I now have my FTP client setup to change the permissions on upload!
Change the permition chmod 644 to the file is presenting the error –> /opt/lampp/htdocs/xampp/proyect/file.php
From the Google results list, it looked like you called your whole diary Permission denied in Unknown on line 0 – which I thought was funny. You solved my problem thanks!
Muchas gracias…;)
I have tried changing permissions on phpinfo.php to 777 via Filezilla and it did not work.
Is this the way to do it?
Is this the file to change permissions?
In my case the file was inside folder /public.
Please advise.
Thanks
Joni
works like magic.. thank you 🙂
thank you 😀 You save me a some debugging time 🙂
Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0
Fatal error: Unknown: Failed opening required ‘/home/protechs/public_html/index.php’ (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in Unknown on line 0
I move a site to a new host and I was working on it; editing pages and style sheets. Then After 4-5 hrs it went down for two days now.
when you visit the site , it displays this err :
[
Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0
Fatal error: Unknown: Failed opening required ‘/home/protechs/public_html/index.php’ (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in Unknown on line 0
]
we call the tech support guys @ the web host company but, we didn’t hear anything from them for two days now. Any idea what should be done to fix it?
thanks
How to fix this err?
”
Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0
Fatal error: Unknown: Failed opening required ‘/home/protechs/public_html/index.php’ (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in Unknown on line 0 ”
Site down for 5 days cuz of that err!
plis help me, i have problem when access phpmyadmin
erros message :
Access forbidden!
New XAMPP security concept:
Access to the requested object is only available from the local network.
This setting can be configured in the file “httpd-xampp.conf”.
If you think this is a server error, please contact the webmaster.
Error 403
10.2.117.154
Apache/2.4.2 (Unix) OpenSSL/1.0.1c PHP/5.4.4
how to fix this??
I just can’t tell you how much relieved I am getting this piece of info. It brought an end to my day-long search for this solution. Where all else failed, this worked!
Thanks a bunch!
Sometimes the working of the Private Detective Denver. For
example, if you are trying to reach is not working.
Scroll down for videoAccording to his acquaintances who spoke
to 48 Hours Mystery, the women said they were unaware of the illegal activities carried
out in one sitting. There’s technically no” best” ELO rating, but if it hasn’t happened yet, you’d like to know how to get the target to do something extra to protect and maintain the intellectual properties.
I think this is among the most important info
for me. And i’m glad reading your article. But should remark on some general things,
The site style is ideal, the articles is really great : D.
Good job, cheers. Products in order to how to get views on youtube, we could
assist you!
buy youtube subscribers Low-cost and Protect regarding youtube
account.
I have fun with, result in I discovered exactly what I was having a look for.
You have ended my four day lengthy hunt! God Bless you man.
Have a great day. Bye. facebook like in facebook Protected and straightforward from most significant facebook likes company.
If you would like buy likes towards your facebook account, there are many
extremely effective approaches.
buy usa facebook likes Lowest Selling prices Ideal Support.
Excellent keen synthetic eyesight pertaining to details and can
foresee difficulties before these people take place.
I have an excited analytical attention regarding details and may anticipate complications before
these people happen.
Whats up! I simply want to give a huge thumbs up for the good information you¡¦ve here on this
post. I will probably be coming again to your blog
for more soon.
Hi everybody, here every person is sharing these experience, therefore it’s fastidious to read this web site, and I used to
pay a visit this blog everyday.
I love to disseminate knowledge that will I have accrued with the yr to help improve team performance.
Good day! I just want to give a huge thumbs up for the good
information you¡¦ve right here on this post.
I can be coming again to your blog for more soon.
Bruv…..ure a life saver! I have not worked an app for a week because of this misleading php log. Thanks mate!!!
Pensiuni Vatra Dornei
Excellent beat ! I would like to apprentice while you amend your website, how can i subscribe for
a blog website? The account helped me a acceptable deal.
I had been tiny bit acquainted of this your broadcast offered bright clear idea
Can you tell us more about this? I’d love to find
out some additional information. youtube
youtube
Awesome things here. I am very satisfied to look your article.
Thank you so much and I’m having a look forward to contact you.
Will you please drop me a e-mail?. youtube
youtube
Hi my friend! I wish to say that this post is awesome, nice written and come with approximately all important infos.
I would like to look extra posts like this . youtube
youtube
Please make a video tutorial for better understand. I still in trouble with iPage hosting. Thanks in advance
Your the best!!!!!!!
your the best.. thank you very much
Skype has established its internet-structured consumer beta towards the world, soon after starting
it broadly from the U.S. and You.K. earlier this month. Skype for Internet also now can handle Linux and Chromebook for instant
online messaging conversation (no video and voice yet, individuals
demand a plug-in set up).
The expansion of the beta brings support for an extended set of different languages to assist
reinforce that overseas usability
Thanks!! I solved my problem!