ShivaGupta Posted October 2, 2013 Share Posted October 2, 2013 (edited) 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 October 2, 2013 by ShivaGupta Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted October 2, 2013 Share Posted October 2, 2013 Some code is causing that. Quote Link to comment Share on other sites More sharing options...
ShivaGupta Posted October 2, 2013 Author Share Posted October 2, 2013 Some code is causing that. that script working fine with other server only provlem with my new server . Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted October 2, 2013 Share Posted October 2, 2013 The webserver user doesn't have permission to open img/120300.png on this server. Quote Link to comment Share on other sites More sharing options...
ShivaGupta Posted October 2, 2013 Author Share Posted October 2, 2013 The webserver user doesn't have permission to open img/120300.png on this server. so plz tell how to give permission to open img ? Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted October 2, 2013 Share Posted October 2, 2013 The script your using is wanting trying to write data to img/120300.png. So you need to give the file 120300.png sufficient write permissions. If it is creating the file 120300.png then you need to give the img/ folder sufficient write permissions. The following wiki article may help https://wiki.debian.org/Permissions Quote Link to comment Share on other sites More sharing options...
ShivaGupta Posted October 2, 2013 Author Share Posted October 2, 2013 (edited) 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 October 2, 2013 by ShivaGupta Quote Link to comment Share on other sites More sharing options...
Solution jazzman1 Posted October 2, 2013 Solution Share Posted October 2, 2013 PHP supports chmod() . Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted October 2, 2013 Share Posted October 2, 2013 (edited) 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 October 2, 2013 by AbraCadaver Quote Link to comment Share on other sites More sharing options...
ShivaGupta Posted October 2, 2013 Author Share Posted October 2, 2013 finly soleved by these commond... chmod 777 /var/www chmod 777 /var/www/* Thanks To All.. Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted October 3, 2013 Share Posted October 3, 2013 @Shiva, by default the owner of "www" directory is "root", don't do this! Is it a public or local server? Quote Link to comment Share on other sites More sharing options...
ShivaGupta Posted October 5, 2013 Author Share Posted October 5, 2013 (edited) @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 October 5, 2013 by ShivaGupta Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.