Permission denied in Unknown on line 0

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.)

Advertisements

93 thoughts on “Permission denied in Unknown on line 0

  1. 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!

  2. 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.

  3. 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!

  4. 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!!!

  5. 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!

  6. 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.

  7. 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.

  8. 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.

  9. 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

  10. 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

  11. 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.

  12. 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.

  13. Pingback: Permission denied in Unknown on line 0 | Consulente di informatica a Roma
  14. 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.

  15. 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 🙂

  16. 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

  17. 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.

  18. 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.

  19. 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!!

  20. 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.

  21. 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

  22. 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.

  23. 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.

  24. 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.

  25. 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

  26. Wish I could have found this sooner! worked like a charm. I now have my FTP client setup to change the permissions on upload!

  27. Change the permition chmod 644 to the file is presenting the error –> /opt/lampp/htdocs/xampp/proyect/file.php

  28. 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!

  29. 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

  30. 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

  31. 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

  32. 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!

  33. 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??

  34. 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!

  35. 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.

  36. 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.

  37. 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.

  38. Whats up! I simply want to give a huge thumbs up for the good information youve here on this
    post. I will probably be coming again to your blog
    for more soon.

  39. 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

  40. I’m pretty pleased to uncover this web site. I
    need to to thank you for ones time just for this fantastic read!!
    I definitely loved every part of it and i
    also have you book marked to check out new
    stuff on your site.

  41. 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

  42. Spot on with this write-up, I absolutely feel this amazing site needs
    a great deal more attention. I’ll probably be
    returning to read through more, thanks for the info!
    instagram
    instagram

  43. 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

  44. When it relates to green leafy vegetables, the question is
    exactly what’s using a package of salad greens if this says
    “best by” (date) rather than “use by” date. That would be to say
    internal organs like heart liver kidneys etc. Does eggs go bad You bought
    the ticket to attempt to win, as well as the higher the jackpot the
    higher.

    Animals provide us with clues as for the changing environment around us, for example birds flying using directions for several days or
    weeks prior to season changes. If certainly one of these three is absent undesirable link between bacteria,
    yeasts & moulds could be reduced or eliminated.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s