Jul 26, 2008

Problem With Opening And Reading Files In Php - access denied error using fopen etc...

Free Web Hosting, No Ads > General > Hosted Members Area

free web hosting

Problem With Opening And Reading Files In Php - access denied error using fopen etc...

shadowx
Hi all

I'm having a problem when using php to read from a text file the error is this:
CODE
failed to open stream: Permission denied in /home/shadyx/public_html/index.php


And this obviously stops fread and fwrite from working. the code i used for this is...
CODE

$handle = fopen("ipstuffs/iplog.htm", "a");
fwrite($handle, "date: $date <BR> $ip <BR>Referrer: $refer_url<BR><HR><BR>");
fclose($handle);


It runs nicely on my xampp IDE so i dont think its the code, possibly a setting in the ini file but i do not know how to edit that ( if its even possible ) online. Can anyone shed light on this problem? in the file manager in the cpanel i have set permissions for user and group to all as i thought this could be the problem but it had no effect.

Please help sad.gif

Thanx

 

 

 


Reply

jlhaslip
have you set user, group, world permissions to a full "777"?

and why print the html br tags and the hr tags to the file? maybe try comma seperated format?


Reply

shadowx
i have just set the directory public_html to 777 and the same error still. its odd as it is able to read from another file yet when writing to that file it gives the same error that access is denied. So it must be something with the write permissions but i cant think why.

And i add the BR and HR tags because its a plain text file printed into the html content so is parsed as normal html and this way i can stop people posting things like html tags and js scritps etc... im just not advanced enough yet to use commas and such laugh.gif


***EDIT: I had to change the permissions for the individual files in question which i have now done and it now works perfectly. smile.gif thanks for the help. Hope other people learn from my mistake because that was annoying!

Thanx

Reply

rvalkass
Just setting the public_html directory to 777 does not necessarily work. Different FTP programs work in different ways for CHMOD, some apply the settings just to the folder, some to everything within it and some ask. Make sure you specifically set that file to permissions of 777.

Reply

jlhaslip
here is more information on chmod, file and directory permissions, etc.: http://www.linuxpowered.com/html/editorials/file.html#sticky

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Recent Queries:-
  1. php opening files with username password - 28.38 hr back. (1)
  2. php opening files on server password - 28.54 hr back. (2)
  3. fopen denied php - 37.55 hr back. (1)
  4. access denied to php upload file - 38.28 hr back. (1)
  5. problems opening .php pages - 74.28 hr back. (1)
  6. php fopen access denied - 74.29 hr back. (1)
  7. joomla explorer chmod failure - 76.87 hr back. (1)
  8. (access is denied) problem in writing file to remote server - 104.25 hr back. (1)
  9. error opening/reading file: - 104.83 hr back. (1)
  10. php fopen access - 128.22 hr back. (1)
  11. problem in opening php files - 129.82 hr back. (1)
  12. a database error occurred: access denied for user joomla subdomain - 184.28 hr back. (1)
  13. an error has occurred while attempting to change your password. please contact your system administrator squirrel -wikipedia - 198.55 hr back. (1)
Similar Topics

Keywords : problem, opening, reading, files, php, access, denied, error, fopen

  1. Wordpress Error - Bytes Exausted
    NextGEN Gallery (5)
  2. Phpbb3 - Error 28
    (5)
    I get the following error when I try changing a users group of my Phpbb3 powered forums. QUOTE
    SQL ERROR Got error 28 from storage engine SQL SELECT ug.*, g.* FROM groups g, user_group ug
    WHERE ug.user_id = 83 AND g.group_id = ug.group_id ORDER BY g.group_type DESC, ug.user_pending ASC,
    g.group_name BACKTRACE FILE: includes/db/mysql.php LINE: 158 CALL: dbal->sql_error() FILE:
    includes/acp/acp_users.php LINE: 1881 CALL: dbal_mysql->sql_query() FILE:
    includes/functions_module.php LINE: 471 CALL: acp_users->main() FILE: adm/index.php LINE: 74 CALL:
    p_master->l....
  3. Error 28 (on Phpmyadmin)
    What does this error message mean? (6)
    I have a shopping cart system on my website. It always worked before, but all of a sudden, when I
    try to access it i get "Got error 28 from storage engine". Has that got something to do with the
    recent problems again, or can someone tell me what this error message means? Thanks. After posting
    this I noticed I cannot get into my PHPAdmin anymore. It gives loads of errors: QUOTE Warning:
    session_write_close() : SQLite: session write query failed: database is full in
    /usr/local/cpanel/base/3rdparty/phpMyAdmin/index.php on line 42 Warning: session_write_close() :
    Fai....
  4. No Site Access
    (4)
    It was working the day before yesterday and then it started giving me error messages about not being
    able to access the site. I can't access cpanel either. Neither page ever loads. I don't
    have this problem with any other internet pages, just my site stuff on Trap17. My site's at
    www.jzambrano.trap17.com btw. This is one of the few times I'll need it up for sure so I'd
    appreciate if the issue can get fixed in the near future. ....
  5. Can't Access My Site An Cpanel
    already did some sugested things (4)
    I still can't get to my website and cpanel, Tings I did: requested xisto to unblock my ip
    cleaned my cache/cookies Did this with both IE and FF When I am @ my dads house he can acces my
    website. So I guess it is still an ip problem. I did read some posts but couldn't find a
    solution. Thx in advance,....
  6. Can't Access My Site....weird Issue
    (5)
    Okay, so last night everything worked fine. I loaded up cpanel, fixed issues with the site after the
    database move, etc. Today I'm unable to load up the site. It just keeps giving me ping
    timeouts. With what I'm being told by others it is only me having this issue with my site, and
    yet there have been 0 changes to my pc between it working and not. I have tried multiple times
    during the day with no luck. Along with this, if I load my website using a proxy service then I do
    not have any issues. The only time it will not allow me to access it is if I am "using" my....
  7. Almost There, However.... [resolved]
    Cannot access webmail yet. (7)
    After all the troubles over the past week, I have everything set up, my access to MySQL databases
    restored, however, I cannot access my webmail yet. I log in on the screen before you get the choice
    which webmail to use (Squirrel, Horde or Roundcube), and when clicking on Horde I get "Login failed
    because your username or password are incorrect", with Squirrel mail i get; "ERROR: Connection
    dropped by IMAP server." and Roundcube (probably as the name implies) keeps going round in circles.
    According to the opening screen of cpanel, I have 3 email accounts (as it should be)....
  8. How Do I Find My Mysql Password? [resolved]
    Cannot access my MySQL (5)
    After all the recent problems, my account has been restored. I have setup my parked domain agin, and
    that works fine. However, I can no longer access my MySQL databases (I can from PHPMyAdmin, but
    that's all). I had to create a new user for my databases, and created the user with exactly the
    same username and password I had before, but some of my web pages do not let me access the pages I
    have associated with my databases. Where could i find out what my DB password is? (Although I am as
    good as sure I am using the right one). I have tried my old password, the new c....
  9. Page Load Error When Accessing Cpanel
    (0)
    Not sure what the issue is. I cannot even load up any of the cpanel's to allow me to put in a
    password. I have tried the link that is located in the Credit System 2.0 I have tried the links
    with subdomain/cpanel I have tried the links with subdomain:2082 All 3 of these just give page
    load errors. Please note : This isn't a "my password doesn't work" thread. This is a "I
    can't even get cpanel to TRY to load" thread. Thanks in advance.....
  10. Coppermine Gallery Error
    (2)
    Okay.. so i have my gallery set up at photos.chantellepaige.org and everytime i try to access it i
    get this error "Coppermine critical error: Unable to connect to database ! MySQL said: Access
    denied for user 'giselle_copp1'@'localhost' (using password: YES)" how do i change
    the password etc?? or fix the problem??....
  11. Official: Can't Access My Cpanel - Supports From Admins
    (69)
    Scroll down to Post #8 for Admin Support Ok I've read stuff here and there in the support
    forum and shoutbox about the recent trap17 server problem. I'm extremely confused. Some people
    say that their websites are working fine. Some people are experiencing different issues from mine,
    had their website reset or something. I can access my website on the gamma server, so I assume that
    if I unpark and park my domain again, I can get it to work like the last time. I accessed my cpanel
    at bishoujo.trap17.com/cpanel because the 'Access CPanel' link on the fo....
  12. I Cant Access The Server!
    (1)
    i can not establish a connection AT ALL!! my ftp program (Core FTP LE) cannot connect,
    neither can my online ftp..... also, i cannot log in to my cpanel!! in short, i
    cant do ANYTHING!!! can anyone help me?? better question, is the server down? and im
    not aware of it? /mad.gif" style="vertical-align:middle" emoid=":angry:" border="0" alt="mad.gif"
    />....
  13. Remote Access Mysql
    (8)
    Is it possible to directly access my local database from my website? For example, if somebody
    submits info on my website, the info they submitted would be transferred to my local database
    directly. Is that possible? And if so, how do I set that up? The reason I don't want to upload
    my database to my subdomain is because it would be difficult to keep the website database and my
    local database in sync . . . or is there a way to do that? Thanks for any replies.....
  14. Anonymous Ftp Access?
    (2)
    Hi, my subdomain here is tf2maps.trap17.com, and I was wondering, how do you enable anonymous ftp
    access for the public_ftp folder? I cant seem to find the option in Cpanel. And every time I try to
    access http://tf2maps.trap17.com/public_ftp/tf/ it gives me a 404 error? Is there any way of
    seeing my folders in the browser? Thank you! /biggrin.gif" style="vertical-align:middle"
    emoid=":D" border="0" alt="biggrin.gif" />....
  15. Phpmyadmin Error [resolved]
    (7)
    I get this error message each time I attempt to work phpMyAdmin. QUOTE Cannot start session
    without errors, please check errors given in your PHP and/or webserver log file and configure your
    PHP installation properly. Help would be very grateful.....
  16. Phpmyadmin Error
    Not able to enter PhpMyAdmin (4)
    Currently I try to access my PhpMyAdmin and I get the following error displayed among the screen:
    My PhpMyAdmin worked prior the migration but suddenly stopped working after. I wanted to know if
    anyone else is getting this error also or anyway can help me fix this o.o.....
  17. Server Issues? Web Site Down? Cpanel Access?
    Server Migration issues to report. (48)
    I tried downloading my email from website this morning and Thunderbird said it couldn't access
    it the server. Then I tried loading my website - to no avail. Does anyone have any idea what's
    going on? Is anyone else experiencing this? Seems like this is the second time this spring this has
    happened. Is an upgrade going on, or something? Thanks in advance for your help! ....
  18. Sub Domain Problem : Urgent
    Cannot access my sub domains (10)
    Hi, I am having some serious problems with my sub domains. I registered a site with trap17 named
    http://zoebelkin.co.cc . Then I made 2 sub domains for the site. One is for the forums section
    and the other is for the gallery section. 1> forums.zoebelkin.co.cc 2> gallery.zoebelkin.co.cc
    Whenever I type these in the browser adress bar the browser gives an output that it cannot find the
    web sites. But they are complete and should show something. Also using www. in front of the sub
    domains didn't help. Is www. needed in front of the sub domains. Could you just....
  19. Mysqli Error - Phpbb3
    (3)
    Ok, my forum (phpbb3) works but sometimes it displays this message CODE General Error SQL ERROR
    [ mysqli ] Can't connect to local MySQL server through socket
    '/var/lib/mysql/mysql.sock' (2) [2002] An sql error occurred while fetching
    this page. Please contact an administrator if this problem persists. This normally happens about
    once a week for about 2 minutes but it is really getting annoying. I installed phpbb3 fine, it
    didn't show any errors. But the main thing is that before this happens normally I can't
    connect....
  20. Cannot Access Cpanel...
    (3)
    hey guys, its starting to irritate me how my computer is somewhat dumb...I don't know if its
    something I did or what, but maybe somebody can help. I go to my cpanel, from any link I try it says
    internet explorer cannot find page or whatever the heck it says...but wait....i go to my
    laptop...and what happens? perfect, however i hate my laptop to death cuz it does not have nearly
    anything and im not supposed to use it for anything but work, and its connection SUCKS...so ya, does
    anybody think they know how to fix it? im trying to download firefox and or opera right no....
  21. Has Anyone Ever Seen This Before?
    Permission Denied on FTP Client (7)
    For some odd reason, one of the folders in my template folder cannot be renamed, deleted or edited
    in any way. I simply get the error 550 Rename/move failure: Permission denied upon trying to do any
    of the aforementioned things. I can download everything from it just fine, but as soon as I do
    anything to write to it or delete it, it gives me that error. I'm 99% sure its a glitch in the
    host because I've tried FileZilla and SmartFTP only to yield the same results. I have also tried
    using the file upload script on my control panel. A quick google gave very little i....
  22. Unable To Access Cpanel
    (6)
    I'm not able to access the cPanel for my hosting account, I get the following error, CODE
    The connection has timed out The server is taking too long to respond. I tried accessing the
    cPanel from http://gamma.xisto.com/cpanel ....
  23. Parse Error: Syntax Error, Unexpected '<' On Line 29
    (11)
    ok when i try and access the page i want, iget the following error: Parse error: syntax error,
    unexpected ' however, my page looks like this: QUOTE // Connects to your Database
    $username = "evolved_creation"; $password = "mypasswordishere"; $hostname =
    "localhost"; $dbh = mysql_connect($hostname, $username, $password) or
    die("Unable to connect to MySQL"); $selected =
    mysql_select_db("evolved_clancreation",$dbh) or die("Could not connect to DB");
    mysql_close($dbh); //checks cookies to make sure they ar....
  24. Css Problem On Website
    I've uploaded the html/css files but the css isn't working/ (8)
    Help? I've uploaded all of the html files and css files into the public_html folder , but the
    css isn't taking effect. I've checked both the css and te html files , nothing wrong with
    them. Halp me? www.genesis.trap17.com/home.html /sad.gif" style="vertical-align:middle" emoid=":("
    border="0" alt="sad.gif" />....
  25. Keep Getting Socket Error
    mail won't send. (3)
    When trying to send email, I keep getting a socket #10061 error. I use the Trap 17 smtp server,
    related to my own domain, which is mail.vlaanderen-flanders.org.uk. This seems to be happening
    regularly lately. Has anyone got any idea why this could be happening? Thanks for any support. ....
  26. Problems With Ftp Access
    (1)
    Well topic title says its all I have problem with ftp access to my account here on trap17 so if
    anyone has experienced similar issues lately. The problem is when I try to log on it disconnects me
    from the server. I am using filezilla however I have tried to access trough file manager and it
    works fine though it is not the same protocol. I must admit I have deleted some folders recently
    however I am quite certain that it is all connected to the joomla installation and not some system
    files but if there is some specified folder for ftp could you plese write down so I cou....
  27. I Cannot Access My Site. [resolved]
    Am I blocked by Firewall? (13)
    Hi, is there a server problem? All of a sudden I cannot get through to
    http://www.vlaanderen-flanders.org.uk anymore, nor can I FTP. Could someone check this out,
    please?....
  28. Error Code In Subscriptions Page
    problems subscribing to topics (5)
    I'm seeing some weird warning message show up at the top of my page when I go into "my
    controls," then load my topic subscriptions page. At the top of the page, the following code appears
    several times: IPB WARNING in_array() : Wrong datatype for second argument (Line: 2711 of
    /sources/action_public/usercp.php) I'm guessing maybe that has something to do with the fact
    I'm having problems subscribing to my topics and posts? Thanks in advance for your help.....
  29. Is It Possible To Access The Mysql Remotely?
    (10)
    I like to experiment with a lot of things and I was thinking of making a sort of instant messenger
    in Python, but I want to let people have actual accounts so I need to be able to access the mySQL
    remotely. If that's not possible, are we allowed to run Python scripts on the server?....
  30. 403 Forbidden Error When Accessing My Site
    (11)
    umm this is a problem that i have been looking in other topics to try to fix but i can't seem to
    find a answer to what i lookin for. I got my site workin again the other day ok and so i went on to
    see it (so i can make more changes) and when i got there i got this QUOTE Forbidden You
    don't have permission to access / on this server. Additionally, a 403 Forbidden error was
    encountered while trying to use an ErrorDocument to handle the request. Apache/1.3.33 Server at
    www.clansga.trap17.com Port 80 now i looked at everything and i can't seem to find t....

    1. Looking for problem, opening, reading, files, php, access, denied, error, fopen

Searching Video's for problem, opening, reading, files, php, access, denied, error, fopen
advertisement



Problem With Opening And Reading Files In Php - access denied error using fopen etc...



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE