Jump to content

Fopen and Curl give permission denied errors


Wienke

Recommended Posts

Whenever I use fopen or curl I always get a [i]"Warning: fopen(/tmp/test) [function.fopen]: failed to open stream: Permission denied" [/i] error. It happens when opening local files and http files. I am using php 5.1.4 and I have set safe mode to OFF and set allow_url_fopen to ON.

I am using this code
[code]
echo $url = "/tmp/test";
if ($handle = fopen($url, "r")) {
$xml = stream_get_contents($handle);
fclose($handle);
echo $xml;
} else {
echo "KRAK";
}
[/code]
I have "chmod 777"-ed the /tmp/test

When I do a normal curl or request as the apache user I can access the files.
Link to comment
Share on other sites

I chmod-ed all the files to 777 but it still won't work. The funny thing is when I run the script on the command line with only php e.g. "sudo - u apache php /var/www/html/test.php" it works but if I run it through the webserver it gives the error.

So it could be that the problem lays within apache? Anyone ever seen this problem?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.