Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

License ignored ? #163

Closed
belgattitude opened this issue Jun 25, 2016 · 11 comments
Closed

License ignored ? #163

belgattitude opened this issue Jun 25, 2016 · 11 comments

Comments

@belgattitude
Copy link

belgattitude commented Jun 25, 2016

Hi Ilia,

thank you so much for good work. Just updated some install scripts and realized that with the latest releases (1.0.2 both PHP5 and PHP7), the license seems to be ignored.

Error: ExcelSheet::write(): Failed to write cell in row 0, column 0 with error 'can't write row 0 in trial version'

I've tested it with by passing it to the constructor

$xlBook = new \ExcelBook('<YOUR_LICENSE_NAME>', '<YOUR_LICENSE_KEY>', true);

but also via php.ini settings (ini_set(...)) and two different version of LibXL (3.6.5 and 3.6.2)

Downgrading to v1.0.1 (php5) or johnmue php7 branch solves the license problem. It does not look to be about LibXL, neither unicode related stuff (no special chars in my license name, only a space and 2 capital letters, a bit like "John Doe").

Was there a change I'm not aware about license in v1.0.2 ? or someone has successfully made it works ?

Keep the good work, very useful for many and if I can help let me know.

Sébastien

PS:
Here two gist with with the example install script to quickly test installs on php7 and php5. Easy to exchange versions to test, don't use for other than testing, not really safe scripts

@popovserhii
Copy link

+1
I have same problem

@iliaal
Copy link
Owner

iliaal commented Jun 26, 2016

Can you do a grep for HAVE_LIBXL_SETKEY inside the excel compilation directory and see if that is defined? In my tests here license works correctly, as all excel tests pass. This define determines if the license is to be used...

@iliaal
Copy link
Owner

iliaal commented Jun 26, 2016

Also make sure you've ran the ./configure command before the compilation, because if you didn't and replied on previous run the define won't be there and license won't work.

@belgattitude
Copy link
Author

belgattitude commented Jun 26, 2016

Hi Ilia,

Here's the files where I found 'HAVE_LIBXL_SETKEY' just after unzip and run phpize :

image

Right after that I call configure, then make and make install (see the complete steps in PS, it may give you some more insights). But still no luck.

Is there a possibility that setting excel.license_name and excel.license_key in php.ini prior to phpize make a change ? (Not sure about this question :)) (tested nothing change)

Is there a mistake in the install process ? Or maybe related to using pre-built binaries by ondrej (tested both php 5.6 and 7 without success on Ubuntu Xenial)

PS:

Installing and configuring the extension (assuming ondrej/php ppa, php7 and libxl in /opt/libxl-3.6.5)

$ wget https://github.com/iliaal/php_excel/archive/Excel-1.0.2-PHP7.zip
$ unzip Excel-1.0.2-PHP7.zip 
$ cd php_excel-Excel-1.0.2-PHP7/
$ phpize7.0 
$ ./configure --with-php-config=/usr/bin/php-config7.0 --with-libxl-incdir=/opt/libxl-3.6.5/include_c/ --with-libxl-libdir=/opt/libxl-3.6.5/lib64/ --with-excel=/opt/libxl-3.6.5
$ make
$ sudo make install

Check php-excel version

$ php7.0 -d="extension=excel.so" -r "phpinfo();" | grep -i "Excel"
# Will show version
# > excel support => enabled
# > Excel Version => 1.0.2

Create a php test file called test_excel.php

<?php
$license_name = '<MY_LICENSE_NAME>';
$license_key  = '<MY_LICENSE_KEY>';

$book = new ExcelBook($license_name, $license_key, true);
$sheet = $book->addSheet('sheet 1');
$sheet->write(1, 0, 'Always works');
$sheet->write(0, 0, 'Works only with licensed version');

See output of

$ php7.0 -d="extension=excel.so" ./test_excel.php
# PHP Warning:  ExcelSheet::write(): Failed to write cell in row 0, column 0 with error 'can't write row 0 in trial version' in /home/sebastien/tmp/test_excel.php on line 8

@iliaal
Copy link
Owner

iliaal commented Jun 26, 2016

Can you please run grep after configure, as configure supposed to set the
define. On my test system both ini settings and params to constructor work.
I suspect the define is not being set for some reason by the configure
script.

That said being able to hardcore licensing settings during configure is an
interesting feature.
On Jun 26, 2016 9:52 AM, "Sébastien Vanvelthem" notifications@github.com
wrote:

Hi Ilia,

Here's the files where 'HAVE_LIBXL_SETKEY' just after unzip and run
phpize :

[image: image]
https://cloud.githubusercontent.com/assets/259798/16362626/56348b44-3bb4-11e6-8123-571133617424.png

Right after that I call configure, then make and make install (see the
complete steps in PS, it may give you some more insights). But still no
luck.

Is there a possibility that setting excel.license_name and
excel.license_key in php.ini prior to phpize make a change ? (Not sure
about this question :))

PS:

Installing and configuring the extension (assuming ondrej/php ppa, php7
and libxl in /opt/libxl-3.6.5)

$ wget https://github.com/iliaal/php_excel/archive/Excel-1.0.2-PHP7.zip
$ unzip Excel-1.0.2-PHP7.zip
$ cd php_excel-Excel-1.0.2-PHP7/
$ phpize7.0
$ ./configure --with-php-config=/usr/bin/php-config7.0 --with-libxl-incdir=/opt/libxl-3.6.5/include_c/ --with-libxl-libdir=/opt/libxl-3.6.5/lib64/ --with-excel=/opt/libxl-3.6.5
$ make
$ sudo make install

Check php-excel version

$ php7.0 -d="extension=excel.so" -r "phpinfo();" | grep -i "Excel"

Will show version

> excel support => enabled

> Excel Version => 1.0.2

Create a php test file called test_excel.php

';$license_key = '';$book = new ExcelBook($license_name, $license_key, true);$sheet = $book->addSheet('sheet 1');$sheet->write(1, 0, 'Always works');$sheet->write(0, 0, 'Works only with licensed version'); See output of $ php7.0 -d="extension=excel.so" ./test_excel.php# PHP Warning: ExcelSheet::write(): Failed to write cell in row 0, column 0 with error 'can't write row 0 in trial version' in /home/sebastien/tmp/test_excel.php on line 8 — You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com//issues/163#issuecomment-228602412, or mute the thread https://github.com/notifications/unsubscribe/AAJsBMVk0h9MGxAY8bPkLlTB1KU4jPgMks5qPoQHgaJpZM4I-a6- .

@belgattitude
Copy link
Author

Yes, after cleaning my test directories and

$ phpize7.0
$ ./configure --with-php-config=/usr/bin/php-config7.0 --with-libxl-incdir=/opt/libxl-3.6.5/include_c/ --with-libxl-libdir=/opt/libxl-3.6.5/lib64/

Here's the result of the search :

image

Hope it helps

@belgattitude
Copy link
Author

belgattitude commented Jun 26, 2016

Also here's the output of configure command, my attention have been caught on

checking lib dir for libxl... yes, shared
checking libxml2 install dir... yes, shared
checking for excel includes... found in /opt/libxl-3.6.5/include_c/
checking for excel libraries... found in /opt/libxl-3.6.5/lib64/
checking for libxml2... not found

Is there something that could be the cause ?

PS/ full output

./configure --with-php-config=/usr/bin/php-config7.0 --with-libxl-incdir=/opt/libxl-3.6.5/include_c/ --with-libxl-libdir=/opt/libxl-3.6.5/lib64/
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib
checking for PHP extension directory... /usr/lib/php/20151012
checking for PHP installed headers prefix... /usr/include/php/20151012
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... re2c
checking for re2c version... 0.16 (ok)
checking for gawk... gawk
checking whether to enable excel support... yes, shared
checking C include dir for libxl... yes, shared
checking lib dir for libxl... yes, shared
checking libxml2 install dir... yes, shared
checking for excel includes... found in /opt/libxl-3.6.5/include_c/
checking for excel libraries... found in /opt/libxl-3.6.5/lib64/
checking for libxml2... not found
checking for xlCreateBookCA in -lxl... yes
checking for xlBookSetKeyA in -lxl... no
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking for gawk... (cached) gawk
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
configure: creating ./config.status
config.status: creating config.h
config.status: executing libtool commands

iliaal pushed a commit that referenced this issue Jun 26, 2016
iliaal pushed a commit that referenced this issue Jun 26, 2016
@iliaal
Copy link
Owner

iliaal commented Jun 26, 2016

The problem is "checking for xlBookSetKeyA in -lxl... no"

I just made a patch to the config.m4 file, which I think should fix the issue. Can you fetch latests sources and try again?

@belgattitude
Copy link
Author

Hi Ilia,

You are great, it works !!! 👍

Thanks again and hope you'll still have time to enjoy the week-end.

PS:
For reference, tested on master and php7 branches with PHP 5.6.23 and 7.0.8. LibXL 3.6.5 on Ubuntu Xenial x64.

@popovserhii
Copy link

Hello, @iliaal

Good job!
Thank you for the quick response.

@Gerst20051
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants