dswe30290 2013-09-16 13:01
浏览 80

file_put_contents权限被拒绝+ livedocx

I'm working with LiveDocx and zend framework to generate a word document from a template with values. This is what I do in my controller:

public function createwordAction(){
    $this->_helper->layout->disableLayout();
    $this->_helper->viewRenderer->setNoRender();

    require_once 'Zend/Service/LiveDocx/MailMerge.php';

    try{
        $filename = APPLICATION_PATH . "/../public/license-agreement-template.docx";

        chmod($filename,0777);

        $mailMerge = new Zend_Service_LiveDocx_MailMerge();

        $mailMerge->setUsername('******')
                  ->setPassword('*******');

        $mailMerge->setLocalTemplate($filename);

        $mailMerge->assign('software', 'Magic Graphical Compression Suite v1.9')
        ->assign('licensee', 'Henry Döner-Meyer')
        ->assign('company',  'Co-Operation')
        ->assign('date',     'January 11, 2010')
        ->assign('time',     'January 11, 2010')
        ->assign('city',     'Berlin')
        ->assign('country',  'Germany');

        $mailMerge->createDocument();

        $document = $mailMerge->retrieveDocument('docx');

        file_put_contents('document.docx', $document);
    }
    catch (Exception $e) {
        die ('Application error: ' . $e->getMessage());
    }
}

But I always get the error:

Warning: file_put_contents(document.docx): failed to open stream: Permission denied in /var/www/site/application/controllers/ResultsController.php on line 313

As you can see I tried to change the file permissions with chmod but that didn't do the trick ...

I also tried to change permissions of public folder like this:

$path = APPLICATION_PATH . "/../public";
chmod($path,0777);

But same result was given ..

  • 写回答

2条回答 默认 最新

  • duandu8892 2013-09-16 13:09
    关注

    You should try chmod 777

    chmod($filename,0777);
    
    评论

报告相同问题?

悬赏问题

  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 MATLAB中streamslice问题
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 51单片机中C语言怎么做到下面类似的功能的函数(相关搜索:c语言)
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端