Replies: 6   Views: 3724
Can't add same image twice when using embedhtml on development server.
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 showmax  · 22-10-2013 - 00:26

I am having an issue when trying to create a DOCX from HTML that includes an image twice. 

The code works fine on my local machine running Xampp, but the document is corrupted on our development server, which is using IIS. Since the development server is not within our LAN, I VPN into it. The images all have absolute URLs that use the non-VPN IP, since we do not yet have a domain for the site. I have tried both using the "downloadImages" set to true and false, but neither work as expected. The document has 3 images, and 2 of them are the same. When creating the DOCX, the single image and the second of the 2 show, but the first of the 2 is missing.

Should I assume this is a licensing issue, or is there another reason that this code would work fine on my local machine and not on my development server? Are there issues with IIS or any unusual configurations I need to address?

Posted by jorgelj  · 22-10-2013 - 10:18


It the license is wrong it returns an exception. You should use FastCGI with IIS to run PHP, are your servers running the same version of PHP? do you get any error in your logs?


Posted by showmax  · 22-10-2013 - 19:51


I was getting the license exception when testing outside of the VPN, obviously. However, I do not get any exceptions from inside the VPN. The PHP install on the server is using FastCGI. Both systems are running PHP 5.5.3, and the only PHP error I get is:

Severity: 8192  --> preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead

Here is my log4php log from the server, with a level of debug:

 2013-10-21T15:13:38-07:00 phpdocx_logger INFO  Create a temp file to use as initial ZIP file. DOCX is a ZIP file.

2013-10-21T15:13:39-07:00 phpdocx_logger INFO  Set language.

2013-10-21T15:13:40-07:00 phpdocx_logger INFO  Add converted HTML to word document.

2013-10-21T15:13:40-07:00 phpdocx_logger INFO  Set DOCX name to: C:\inetpub\wwwroot\LeadGen\eventPulse\assets\tempfiles\test.

2013-10-21T15:13:40-07:00 phpdocx_logger INFO  DOCX is a new file, not a template.

2013-10-21T15:13:40-07:00 phpdocx_logger INFO  Remove existing template tags.

2013-10-21T15:13:40-07:00 phpdocx_logger INFO  Add word/document.xml content to DOCX file.

2013-10-21T15:13:40-07:00 phpdocx_logger INFO  Close ZIP file

2013-10-21T15:13:40-07:00 phpdocx_logger INFO  Copy DOCX file using a new name.

Let me know if you need any other information.

Posted by jorgelj  · 23-10-2013 - 20:44


We don't have any issue related to IIS using FastCGI, and we have seen some servers running PHPDocX without error. I recommend you to test the library using the CLI mode and run the same example to check if it creates the document fine.


Posted by showmax  · 28-10-2013 - 19:47


We are trying to eliminate any external factors which might be interfering with PHPDOCX successfully generating a docx file on our server. We would like to see about changing the domain that is registered for PHPDOCX, however we will need to change it again once we move the site into production and have a final domain for our application. Is this an issue, and what rules, if any do we need to know about changing domains/subdomains in the future?

Posted by jorgelj  · 29-10-2013 - 09:44


When you need to change your domain name to production just send us a message.