Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 27th, 2004, 01:05 PM
Authorized User
 
Join Date: Dec 2003
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default imagepng(): Unable to open error

Imagepng was working on my server then I deleted a bunch of stuff and copied it in again. Now my script

<?php

$height = 700;
$width = $height;
$im = ImageCreate($width, $height);
$bck = ImageColorAllocate($im, 0,0,0);

imagePng($im,"chart.png");

?>
gives me the error:

Warning: imagepng(): Unable to open 'chart.png' for writing in c:\hosting\member\blah\fpdf\chart.php on line 8

I need to email the png file out so I have to save it. I checked permissions with

<?php
if (is_writable( "C:\hosting\webhost4life\member\zorger\fpdf\starch art.png")) {
echo "is_writable";
} else {
echo " not writable";
}
?>

And the directory is apparently writable. What else can I try?




 
Old February 27th, 2004, 03:17 PM
Authorized User
 
Join Date: Dec 2003
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It was a permission problem, Everyone must be able to read and write to the file

 
Old April 8th, 2004, 02:29 PM
Registered User
 
Join Date: Apr 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have just solved this same problem. I had

imagejpeg ($new,"map\ukmap.jpg");

and got the apparent permissions problem. Changing to

imagejpeg ($new,"map/ukmap.jpg");

fixed it fine!

 
Old April 8th, 2004, 07:24 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Something that seems curious about this check

Code:
if (is_writable("C:\hosting\webhost4life\member\zorger\fpdf\starchart.png")) {
    echo "is_writable";
} else {
    echo " not writable";
}
Is you are checking a file, not the directory itself.

For anyone that stumbles on this thread and wants to know how to set permissions, read the FAQ:
http://p2p.wrox.com/topic.asp?TOPIC_ID=11962

: )
Rich

::::::::::::::::::::::::::::::::::::::::::
The Spicy Peanut Project
http://www.spicypeanut.net
::::::::::::::::::::::::::::::::::::::::::





Similar Threads
Thread Thread Starter Forum Replies Last Post
C++ Unable to open include file. Allen_T 08 C++ Programming 4 July 7th, 2016 01:43 PM
imagepng(); Error Rhymhoont Beginning PHP 1 March 18th, 2007 03:42 AM
Unable to open Excel with macro guptasourav ASP.NET 1.x and 2.0 Application Design 0 January 18th, 2007 01:52 AM
Unable to open ebook due to DRM Error abel714 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 1 September 2nd, 2006 07:13 PM
unable to open flv file sentme_mail Flash (all versions) 0 December 27th, 2004 06:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.