iliaal / php_excel

PHP Extension interface to the Excel writing/reading library
http://ilia.ws
534 stars 131 forks source link

Unable to find license with LibXL 3.8.0.0 #208

Closed bf0x0r closed 7 years ago

bf0x0r commented 7 years ago

Running into issues with PHP Excel finding the LibXL license in PHP 7. Versions running are Oracle RHEL 7.3, PHP 7.1.7, LibXL 3.8.0.0 and the php7 branch of PHP Excel.
I am using the example in the README and getting the the trial message, even with a valid license. Below are the steps used to compile and the test results. I saw Issue #163 had troubles with the license as well. Pulled down the repo as of d3a245c7b0c22ec726bab4257ec65fa6b717a7ce and still had issues.

It appears I am able to peg the repo version to d3a245c7b0c22ec726bab4257ec65fa6b717a7ce and get it to work with LibXL 3.6.5.0, but we need to update to LibXL 3.8.0.0. Any thoughts?

cd /usr/local/ wget http://www.libxl.com/download/libxl-lin-3.8.0.tar.gz tar xzfv libxl-lin-3.8.0.tar.gz rm -rf libxl-lin-3.8.0.tar.gz git clone -b php7 https://github.com/iliaal/php_excel.git php_excel cd php_excel phpize ./configure --with-excel=shared --with-libxl-incdir=/usr/local/libxl-3.8.0.0/include_c --with-libxl-libdir=/usr/local/libxl-3.8.0.0/lib64 make make test

===================================================================== PHP : /usr/bin/php PHP_SAPI : cli PHP_VERSION : 7.1.7 ZEND_VERSION: 3.1.0 PHP_OS : Linux - Linux example.com 4.1.12-94.3.6.el7uek.x86_64 #2 SMP Tue May 30 19:25:15 PDT 2017 x86_64 INI actual : /usr/local/php_excel/tmp-php.ini More .INIs :

PHP : /usr/bin/phpdbg PHP_SAPI : phpdbg PHP_VERSION : 7.1.7 ZEND_VERSION: 3.1.0 PHP_OS : Linux - Linux example.com 4.1.12-94.3.6.el7uek.x86_64 #2 SMP Tue May 30 19:25:15 PDT 2017 x86_64 INI actual : /usr/local/php_excel/tmp-php.ini More .INIs :

CWD : /usr/local/php_excel Extra dirs : VALGRIND : Not used

TIME START 2017-07-18 16:25:08

FAIL LibXL licensed version vs trial version test [tests/000.phpt]

Jan-E commented 7 years ago

Is not this caused by the fact that you do not have an .ini-file with a excel.license_name= excel.license_key=

bf0x0r commented 7 years ago

Those are in a license.ini that is loaded in PHP. I can call them such as:

$useXlsxFormat = true; $license_name = ini_get('excel.license_name'); $license_key = ini_get('excel.license_key'); $xlBook = new \ExcelBook($license_name, $license_key, $useXlsxFormat);

If I echo those values, it will show the proper values, but PHP Excel does not accept them.

Jan-E commented 7 years ago

Yes, but license.ini is not loaded when running tests/000.phpt

bf0x0r commented 7 years ago

When running the test with d3a245c7b0c22ec726bab4257ec65fa6b717a7ce and libxl-3.6.5.0, the tests/000.phpt pass and the Demo message is not displayed in the xlsx file.

The test fails when I use the updated php7 branch and libxl-3.8.0.0. When I make install and then run the sample script in the readme file, the demo message is displayed as well. It seems that after LibXL 3.6.5.0 and d3a245c7b0c22ec726bab4257ec65fa6b717a7ce there are issues with loading the license file, which is what I running into. Do we need to pass an include on the license file when configuring PHP Excel? If so, what should that be?

Jan-E commented 7 years ago

How old is your license? Could it be that it is too old? With my old license, libxl-3.6.5.9 is the latest version that does not show the 'Please renew your license' in the test. Except the ExcelBook('bar', 'baz') test, of course.

bf0x0r commented 7 years ago

We initially got this license in early 2015.

Jan-E commented 7 years ago

That might be the problem. Mine is from the time that LibXL had release 3.6.2: 2015-04-28

Jan-E commented 7 years ago

3.6.5.41 (Win) still works with my old license. 3.7.0.2 fails. Where did I get those: ftp://xlware.com/build

bf0x0r commented 7 years ago

I've been able to get this compiled on another server running with the same commands in the OP, so this may be specific to the server/VM. Is there any case sensitivity paths with checking for licenses?

bf0x0r commented 7 years ago

Adding the output: https://gist.github.com/bf0x0r/f65cd85f3d60a3a26db4a8ead6bf674d

Jan-E commented 7 years ago

Did 'make test' run flawlessly? Looks like configure is checking the php.ini to which phpize points to.

After updating my license, this:

export CFLAGS=-I/usr/local/include/libxml2
export CPPFLAGS=-I/usr/local/include/libxml2
./configure --with-excel=../libxl-3.8.0.0/ --with-libxl-libdir=../libxl-3.8.0.0/lib64 --with-libxl-incdir=../libxl-3.8.0.0/include_c --with-libxml-dir=/usr/local/lib

resulted in

=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped    :    0
Exts tested     :   47
---------------------------------------------------------------------

Number of tests :   91                91
Tests skipped   :    0 (  0.0%) --------
Tests warned    :    0 (  0.0%) (  0.0%)
Tests failed    :    0 (  0.0%) (  0.0%)
Expected fail   :    0 (  0.0%) (  0.0%)
Tests passed    :   91 (100.0%) (100.0%)
---------------------------------------------------------------------
Time taken      :    7 seconds
=====================================================================

on CentOS 6

bf0x0r commented 7 years ago

===================================================================== TEST RESULT SUMMARY

Exts skipped : 0 Exts tested : 55

Number of tests : 94 94 Tests skipped : 0 ( 0.0%) -------- Tests warned : 0 ( 0.0%) ( 0.0%) Tests failed : 25 ( 26.6%) ( 26.6%) Expected fail : 0 ( 0.0%) ( 0.0%) Tests passed : 69 ( 73.4%) ( 73.4%)

Time taken : 7 seconds

===================================================================== FAILED TEST SUMMARY

LibXL licensed version vs trial version test [tests/000.phpt] Excel date pack/unpack tests [tests/002.phpt] Numeric Data format tests [tests/006.phpt] Text rotation test [tests/009.phpt] Text indentation [tests/010.phpt] Border Styles [tests/012.phpt] Border Colors [tests/013.phpt] Diagonal Border Test [tests/014.phpt] Fill Pattern Test [tests/015.phpt] Locked Format [tests/016.phpt] Hidden Format [tests/017.phpt] Cell Format Detection [tests/027.phpt] Width/Height Checks [tests/029.phpt] Area Clear [tests/034.phpt] Column/Row insertion/removal [tests/035.phpt] Row Read [tests/047.phpt] Column Read [tests/048.phpt] Row Write [tests/049.phpt] Column Write [tests/050.phpt] Sheet protection test [tests/051.phpt] Test the SKIP_NULLS options, that skips null when writing data [tests/074.phpt] Test the ExcelSheet::mergeSize(), ExcelSheet::merge(), ExcelSheet::delMergeByIndex() methods introduced in libxl 3.6.0. [tests/076.phpt] Sheet::colHidden(), Sheet::rowHidden(), Sheet::setColHidden() and Sheet::setRowHidden() [tests/078.phpt] test Sheet::isLicensed() [tests/086.phpt] A bug that casues numberic fields with custom formats to be dectected as dates [tests/number_format_bug.phpt]

Jan-E commented 7 years ago

Before updating my license I got roundabout the same test results.

Jan-E commented 7 years ago

With php 7.1.7 on CentOS6 and an updated license the tests result in:

=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped    :    0
Exts tested     :   44
---------------------------------------------------------------------

Number of tests :   94                94
Tests skipped   :    0 (  0.0%) --------
Tests warned    :    0 (  0.0%) (  0.0%)
Tests failed    :    2 (  2.1%) (  2.1%)
Expected fail   :    0 (  0.0%) (  0.0%)
Tests passed    :   92 ( 97.9%) ( 97.9%)
---------------------------------------------------------------------
Time taken      :    8 seconds
=====================================================================

=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
Excel date pack/unpack tests [tests/002.phpt]
Sheet protection test [tests/051.phpt]
=====================================================================
bf0x0r commented 7 years ago

One new finding is that it appears to be specific to VMs deployed with VirtualBox. VMs deployed with VMWare the issue does not exist. We use both and need this to work on both. Any ideas?

cjsfj commented 7 years ago

I'm able to reproduce this with PHP 7.1.7 and CentOS 7 on latest VirtualBox. The license test fails:

FAIL LibXL licensed version vs trial version test [tests/000.phpt]

Then a bug that I may have found a problem with PHP:

A bug that casues numberic fields with custom formats to be dectected as dates [tests/number_format_bug.phpt]
=====================================================================

You may have found a problem in PHP.

This report can be automatically sent to the PHP QA team at
...

Oddly this doesn't have an issue with a VMWare-based VM.

Jan-E commented 7 years ago

Is this with a recent license? After renewing my license, this issue was solved on a physical machine with centOS6 and PHP 7.1 for me.

johmue commented 7 years ago

Do not trust so much in the isLicensed() test. It relies on a string served by libxl that is dependend from the OS. If you do not have a proper license there should actually fail a lot more tests. ... also from my understanding libxml dependencies should have been removed in the php7 branch.

cjsfj commented 7 years ago

Thanks for the feedback. I've contacted libxl support to confirm our license.

cjsfj commented 7 years ago

Ours was fixed with a new license file.

bf0x0r commented 7 years ago

Getting a new license file addressed the issue.