Это мой код из /module/moduleName/src/moduleName/Form'----Form.php
$dirdata = './data';
$captchaImage = New CaptchaImage(array(
'font' => $dirdata . '/fonts/arial.ttf',
'width' => 250,
'height' => 100,
'dotNoiseLevel' => 40,
'lineNoiseLevel'=> 3,
));
$captchaImage->setImgDir($dirdata. '/captcha');
$captchaImage->setImgUrl($name);
$this->add(array(
'type'=>'Zend\Form\Element\Captcha',
'name'=>'captcha',
'options'=>array(
'label'=>'Please verify you are human',
'captcha'=> $captchaImage,
),
));
Вот вывожу это во вьюхе обычным способом
$form = $this->form;
$form->prepare();
$form->setAttribute('action',$this->url(NULL, array(
'controller'=>'Message',
'action'=>'process'
)));
$form->setAttribute('method', 'post');
echo $this->form()->openTag($form);
<dt>
<?php
echo $this->formLabel($form->get('captcha'));
?>
</dt>
<dd>
<?php
echo $this->formElement($form->get('captcha'));
echo $this->formElementErrors($form->get('captcha'));
?>
</dd>
<?php
echo $this->form()->closeTag()
?>
Получаю ошибку
Warning: imagepng(./data/captcha/d539f04041799f9944ecf2ca662e2690.png): failed to open stream: Permission denied in /var/www/mysite/vendor/zendframework/zendframework/library/Zend/Captcha/Image.php on line 586
Что делаю не так ?