Forum


Replies: 3   Views: 1293
Still getting permission denied
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by bars  · 16-03-2017 - 16:28

Hello!

We are trying to convert an html file to docx file, and came across your solution which might work for us.

I am trying to examine if the conversion will work before we make a purchase, although I am constantly getting Permission denied.

When we read the file with fopen, it does work resulting in a docx file without the external css (not good).

I have followed every post here and checked everything from files permissions to php user running and php.ini configurations, but i keep getting :

PHP Fatal error:  Uncaught Exception: Permission denied on myfile.html. in /Library/WebServer/Documents/pathToPHPDocX/lib/dompdfParser/include/parserhtml.cls.php:308

Stack trace:
#0 /Library/WebServer/Documents/pathToPHPDocX/lib/dompdfParser/include/parserhtml.cls.php(876): PARSERHTML->load_html_file('myfile.htm...')
#1 /Library/WebServer/Documents/pathToPHPDocX/classes/AutoLoader.inc(62) : eval()'d code(629): PARSERHTML->getDompdfTree('myfile.htm...', true, '*', false, ':///')
#2 /Library/WebServer/Documents/pathToPHPDocX/classes/AutoLoader.inc(62) : eval()'d code(601): HTML2WordML->renderDompdf('myfile.htm...', true, '*', false, ':///')
#3 /Library/WebServer/Documents/pathToPHPDocX/classes/CreateDocx.inc(3462): HTML2WordML->render('myfile.htm...', Array)
#4 /Library/WebServer/Documents/hello.php(19): CreateDocx->embedHTML('myfile.htm...', Array)
#5 {main}
  thrown in /Library/WebServer/Documents/pathToPHPDocX/lib/dompdfParser/include/parserhtml.cls.php on line 308

When running from localhost and terminal.

I am using mac OSX with no addons.

 

I need to fix the css not been included when passing html as string, or the permission issue to try and include the css by file.

 

Waiting for a response.

Thank you in advance.

Posted by admin  · 16-03-2017 - 16:36

Hello,

To solve CSS being added as a content of the document, please install and enable Tidy for PHP. About this issue please check the information available on:

https://www.phpdocx.com/documentation/cookbook/convert-html-to-word

There's a warning about this issue. We recommend you to install enable mbstring extension too, to work with all characters.

About your other problem, it's strange, because you are getting a denied access but it you have set 777 access to that file it should load the file. Please check that you have set the isFile option as true of the embedHTML method.

Regards.

Posted by bars  · 16-03-2017 - 17:07

Hey, admin.

Thanks for a quick reply!

The tidy did some of the job, which is pretty good. I can try using the fopen for now. I have checked isFile = true when loading the file, and it's still not working.

On other note, the last thing i need before i can finish my evaluation for now is to import graphs from the html (displayed as svg) is there an option without needing to save them as images?

 

Looking forward for your reply!

Thank you.