permission denied using fopen in php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
issamo
Forum Newbie
Posts: 3
Joined: Thu Jul 06, 2006 10:08 am

permission denied using fopen in php

Post by issamo »

hello I got this problem when I try to open a file in php:

Warning: fopen("CertificationsData.csv", "w") - Permission denied in /data/home/issam/public_html/OpenCertTable.php on line 413

I already chmod 755 all the files under and including my public_html directory. the intersting thing that I tried doing a chmod inside my php script and it gives me this intersting error:

Warning: chmod failed: Operation not permitted in /data/home/issam/public_html/OpenCertTable.php on line 411

do I have to change some configurations in my php..if yes can anyone tell me how?...

are there any other permissions I need to set?

thanks alot for your help.......btw I tried searching on the net didnt find any useful info to help me out too..:(
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

It's a user privileges problem, namely with the user ID that the PHP process executes under.

This can only be resolved by the host, speak to them. :)
issamo
Forum Newbie
Posts: 3
Joined: Thu Jul 06, 2006 10:08 am

Post by issamo »

hi man..thanks for ur reply...actually I have the appache server so I think I can configure it somehow...do you know how can I allow my user ID is allowed to do such a thing?..what commands I need to use plz?

thanks in advance
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

Guessing it's Linux?

It's not apache, but the actual OS privileges that need changing for the user that runs apache and php.
issamo
Forum Newbie
Posts: 3
Joined: Thu Jul 06, 2006 10:08 am

Post by issamo »

found the solution I will put it here for others:

solution:
"permissions for non-executable file should be 644 or 664 or 666 (rw-rw-rw). Permissions for executable files or directories are the ones that need 755 or 775 or 777 (rwx-rwx-rwx) perms."..so I did chmod 666 and it worked..:)
Post Reply