Jump to content

failed to open stream: Permission denied in /var/www/p/phj.php


Go to solution Solved by jazzman1,

Recommended Posts

I keep getting this error 

Warning: fopen(img/120300.png): failed to open stream: Permission denied in /var/www/play/playall.php on line 192 Warning: fwrite() expects parameter 1 to be resource, boolean given in /var/www/play/playall.php on line 193 Warning: fclose() expects parameter 1 to be resource, boolean given in /var/www/play/playall.php on line 194 Warning: file_get_contents(img/120300.png): failed to open stream: No such file or directory in /var/www/play/playall.php on line 196 Fatal error: Call to undefined function imagecreatefromstring() in /var/www/play/playall.php on line 197 

with Apache 2 and PHP 5.3 on

Debian GNU/Linux 6.0 (Squeeze)

Edited by ShivaGupta
Link to comment
Share on other sites

Some code is causing that.

here is line 192

$fh = fopen($path, 'x');

here is code

$abc=curl_exec($ch);
 $name=rand(0, 999999);
		$path='img/'.$name.'.png';		
		
$fh = fopen($path, 'x');
fwrite($fh, $abc);
fclose($fh);

$st=file_get_contents($path);

Edited by ShivaGupta
Link to comment
Share on other sites

PHP supports chmod() .

 

Only works if you're root or the file owner which couldn't be the case or no need to chmod() it.

 

ShviaGupta?  Does the img/ dir exist?  You need to look into Linux file permissions and check the dir if it exists to make sure the Apache user (probably apache or www-data or something) has write permissions.

Edited by AbraCadaver
Link to comment
Share on other sites

@Shiva, by default the owner of "www" directory is "root", don't do this!  Is it a public or local server?

this is a local server and i want to use for my pertional use n only for me..........but can i use in public   server?

Edited by ShivaGupta
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.