Forum


Replies: 3   Views: 1345
Warning message in generatedocx.php
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 Siegfried  · 03-12-2019 - 17:51

What means

Notice: Undefined index: SERVER_ADDR in ..\phpdocx\classes\GenerateDocx.php on line 37

I've set Error-reporting to E_ALL (to geht also the warnings)

I simply did
$docx = new CreateDocx();

.. add some text to $docx

$docx->createDocx('Filename');

The same with Template works without warning message about the SERVER_ADDR

 

best regards Siegfried

Posted by admin  · 03-12-2019 - 19:46

Hello,

phpdocx uses $_SERVER['SERVER_NAME'] (https://www.php.net/manual/en/reserved.variables.server.php) for license checking. Maybe your server is not returning that information (https://stackoverflow.com/questions/465504/server-addr-undefined-index). Please set it to your server configuration or manually. The same GenerateDocx class is used for CreateDocx and CreateDocxFromTemplate (this class extends CreateDocx).

If you can't add that information, please edit GenerateDocx.php and comment that line.

Regards.

Posted by Siegfried  · 04-12-2019 - 09:20

Thank's a lot, the server contains SERVER_NAME but not SERVER_ADDR (I think it's also not specified in RFC 3875 - The Common Gateway Interface (CGI) Version 1.1) and there is no guarantee that every web server will provide any of these. The question is: Is SERVER_ADDR really necessary?

But I'll find a workaround.

best regards, Siegfried

 

Posted by admin  · 04-12-2019 - 09:24

Hello,

It's only needed for the license checking, please comment it or force a value to avoid the PHP notice.

We have moved the topic to the dev team to add a new check in case there's no SERVER_ADDR value set.

Regards.