micha8l Posted January 12, 2011 Share Posted January 12, 2011 Hello, I'm working with Zend Framework on Linux, and I'm trying to generate a CAPTCHA using Zend_Form_Element_Captcha. Whenever the CAPTCHA page loads I get this error: [12-Jan-2011 18:14:54] PHP Warning: imagepng() [<a href='function.imagepng'>function.imagepng</a>]: Unable to open '/var/www/square/application/../public/captcha/ebf44d292149b3ebda05571c54c463a8.png' for writing: Permission denied in /usr/local/zend/share/ZendFramework/library/Zend/Captcha/Image.php on line 563 Here's my code for generating the CAPTCHA: // create captcha $captcha = new Zend_Form_Element_Captcha('captcha', array( 'captcha' => array( 'captcha' => 'Image', 'wordLen' => 6, 'timeout' => 300, 'width' => 300, 'height' => 100, 'imgUrl' => '/captcha', 'imgDir' => APPLICATION_PATH . '/../public/captcha', 'font' => APPLICATION_PATH . '/../public/fonts/LiberationSansRegular.ttf', ) )); I've checked permissions, and all directories mentioned above are accessible to root. Has anyone had a similar problem or have an idea how I can fix this? Kind Regards, Mike Link to comment https://forums.phpfreaks.com/topic/224210-php-linux-unable-to-open/ Share on other sites More sharing options...
AbraCadaver Posted January 12, 2011 Share Posted January 12, 2011 public/captcha/ needs to be writable by the webserver user, not root. So you either need to make it world writable or change the ownership to the webserver user (commonly nobody or www-data). Link to comment https://forums.phpfreaks.com/topic/224210-php-linux-unable-to-open/#findComment-1158478 Share on other sites More sharing options...
micha8l Posted January 12, 2011 Author Share Posted January 12, 2011 Hello AbraCadaver, I just wanted to thank you. Changing the permission on my /var/www/captcha directory for user Zend did indeed work. Link to comment https://forums.phpfreaks.com/topic/224210-php-linux-unable-to-open/#findComment-1158632 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.