I am currently reading a book: Extending and Embedding PHP.
I have Ubuntu 16 . The book wants:
./configure <--- worked.
But with "make all install" I get a error message:
movic/Downloads/php-5.1.0/ext/dom/documenttype.c -o ext/dom/documenttype.lo
/home/tomovic/Downloads/php-5.1.0/meta_ccld -Iext/dom/ -I/home/tomovic/Downloads/php-5.1.0/ext/dom/ -DPHP_ATOM_INC -I/home/tomovic/Downloads/php-5.1.0/include -I/home/tomovic/Downloads/php-5.1.0/main -I/home/tomovic/Downloads/php-5.1.0 -I/usr/include/libxml2 -I/home/tomovic/Downloads/php-5.1.0/ext/date/lib -I/home/tomovic/Downloads/php-5.1.0/TSRM -I/home/tomovic/Downloads/php-5.1.0/Zend -D_REENTRANT -g -O2 -pthread -Wall -DZTS -c /home/tomovic/Downloads/php-5.1.0/ext/dom/documenttype.c -fPIC -DPIC -o ext/dom/.libs/documenttype.o
/home/tomovic/Downloads/php-5.1.0/ext/dom/documenttype.c: In function 'dom_documenttype_internal_subset_read':
/home/tomovic/Downloads/php-5.1.0/ext/dom/documenttype.c:219:42: error: dereferencing pointer to incomplete type 'xmlBuf {aka struct _xmlBuf}'
strintsubset = xmlStrndup(buff->buffer->content, buff->buffer->use);
^
Makefile:408: die Regel für Ziel „ext/dom/documenttype.lo“ scheiterte
make: *** [ext/dom/documenttype.lo] Fehler 1
root#DELL:~/Downloads/php-5.1.0#
Throw that book out and find another one.
PHP 5.1 is completely obsolete -- it was released in 2005, and has not been supported since the release of PHP 5.2 in November 2006. Due to changes in various libraries, it can no longer be compiled on modern Linux systems. Moreover, PHP has gone through a number of internal changes over the last 12 years, and much of the advice in that book is likely to be inaccurate today.
For an up-to-date look at PHP internals, refer to the PHP at the Core: A Hacker's Guide section of the PHP manual.
Related
I'm trying to install intl on Mac os Ventura 13.0.1 with XAMPP 8.1.12 with pecl with this command:
sudo /Applications/XAMPP/xamppfiles/bin/pecl install intl
i cannot use directly pecl because i've also other installed php version.
Obviously i've already installed icu4c with command:
brew install icu4c
Here's result of brew list icu4c
/opt/homebrew/Cellar/icu4c/71.1/bin/derb
/opt/homebrew/Cellar/icu4c/71.1/bin/genbrk
/opt/homebrew/Cellar/icu4c/71.1/bin/gencfu
/opt/homebrew/Cellar/icu4c/71.1/bin/gencnval
/opt/homebrew/Cellar/icu4c/71.1/bin/gendict
/opt/homebrew/Cellar/icu4c/71.1/bin/genrb
/opt/homebrew/Cellar/icu4c/71.1/bin/icu-config
/opt/homebrew/Cellar/icu4c/71.1/bin/icuexportdata
/opt/homebrew/Cellar/icu4c/71.1/bin/icuinfo
/opt/homebrew/Cellar/icu4c/71.1/bin/makeconv
/opt/homebrew/Cellar/icu4c/71.1/bin/pkgdata
/opt/homebrew/Cellar/icu4c/71.1/bin/uconv
/opt/homebrew/Cellar/icu4c/71.1/include/unicode/ (189 files)
/opt/homebrew/Cellar/icu4c/71.1/lib/libicudata.71.1.dylib
/opt/homebrew/Cellar/icu4c/71.1/lib/libicui18n.71.1.dylib
/opt/homebrew/Cellar/icu4c/71.1/lib/libicuio.71.1.dylib
/opt/homebrew/Cellar/icu4c/71.1/lib/libicutest.71.1.dylib
/opt/homebrew/Cellar/icu4c/71.1/lib/libicutu.71.1.dylib
/opt/homebrew/Cellar/icu4c/71.1/lib/libicuuc.71.1.dylib
/opt/homebrew/Cellar/icu4c/71.1/lib/icu/ (4 files)
/opt/homebrew/Cellar/icu4c/71.1/lib/pkgconfig/ (3 files)
/opt/homebrew/Cellar/icu4c/71.1/lib/ (18 other files)
/opt/homebrew/Cellar/icu4c/71.1/sbin/escapesrc
/opt/homebrew/Cellar/icu4c/71.1/sbin/genccode
/opt/homebrew/Cellar/icu4c/71.1/sbin/gencmn
/opt/homebrew/Cellar/icu4c/71.1/sbin/gennorm2
/opt/homebrew/Cellar/icu4c/71.1/sbin/gensprep
/opt/homebrew/Cellar/icu4c/71.1/sbin/icupkg
/opt/homebrew/Cellar/icu4c/71.1/share/icu/ (4 files)
/opt/homebrew/Cellar/icu4c/71.1/share/man/ (15 files)
Now once i try to install intl with pecl i got this error:
cc -I. -I/private/var/tmp/pear/temp/intl -I/private/var/tmp/pear/temp/pear-build-rootQBIGcB/intl-3.0.0/include -I/private/var/tmp/pear/temp/pear-build-rootQBIGcB/intl-3.0.0/main -I/private/var/tmp/pear/temp/intl -I/Applications/XAMPP/xamppfiles/include/php -I/Applications/XAMPP/xamppfiles/include/php/main -I/Applications/XAMPP/xamppfiles/include/php/TSRM -I/Applications/XAMPP/xamppfiles/include/php/Zend -I/Applications/XAMPP/xamppfiles/include/php/ext -I/Applications/XAMPP/xamppfiles/include/php/ext/date/lib -I/include -DHAVE_CONFIG_H -g -O2 -Wno-write-strings -DZEND_COMPILE_DL_EXT=1 -c /private/var/tmp/pear/temp/intl/php_intl.c -MMD -MF php_intl.dep -MT php_intl.lo -fno-common -DPIC -o .libs/php_intl.o
In file included from /private/var/tmp/pear/temp/intl/php_intl.c:25:
In file included from /private/var/tmp/pear/temp/intl/php_intl.h:32:
/private/var/tmp/pear/temp/intl/collator/collator_sort.h:23:76: error: expected ')'
typedef int (*collator_compare_func_t)( zval *result, zval *op1, zval *op2 TSRMLS_DC );
^
/private/var/tmp/pear/temp/intl/collator/collator_sort.h:23:39: note: to match this '('
typedef int (*collator_compare_func_t)( zval *result, zval *op1, zval *op2 TSRMLS_DC );
^
In file included from /private/var/tmp/pear/temp/intl/php_intl.c:25:
/private/var/tmp/pear/temp/intl/php_intl.h:33:10: fatal error: 'unicode/ubrk.h' file not found
#include <unicode/ubrk.h>
^~~~~~~~~~~~~~~~
2 errors generated.
make: *** [php_intl.lo] Error 1
ERROR: `make' failed
Once i start the install intl the script ask me:
Specify where ICU libraries and headers can be found [DEFAULT] :
i simple hint enter and got same error but i've also tried to use:
/opt/homebrew/Cellar/icu4c/71.1/include/unicode/
but same error appear
I'm loosing my mind with this problem!!
Anyone tried installing "
RarArchive
on their macbookpro? I tried installing but I got this error
.1.13/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -DRARDLL -DSILENT -Wno-write-strings -Wall -fvisibility=hidden -I/private/tmp/pear/temp/rar/unrar -DZEND_COMPILE_DL_EXT=1 -c /private/tmp/pear/temp/rar/rar_stream.c -MMD -MF rar_stream.dep -MT rar_stream.lo -fno-common -DPIC -o .libs/rar_stream.o
/private/tmp/pear/temp/rar/rar_stream.c:170:23: warning: format specifies type 'unsigned long' but the argument has type 'uint64' (aka 'unsigned long long') [-Wformat]
self->file_size, self->cursor);
^~~~~~~~~~~~
/private/tmp/pear/temp/rar/rar_stream.c:787:58: error: too many arguments to function call, expected 1, have 2
zend_string *arc_str = zend_resolve_path(tmp_archive, tmp_arch_len);
~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~
1 warning and 1 error generated.
make: *** [rar_stream.lo] Error 1
rolling back 454 file operations
ERROR: `make' failed
Cause I'm trying to solve this warning on my PHP IDE warning.
Thank you!
I tried installing via pecl but it did not work.
I fixed this issue by downgrading the PHP version from 8.1 to 8 and all the error is gone.
Hopefully, this will help others as well.
I am trying to compile the swig interface of crfsuite as a PHP module. So far I've managed to actually compile a crfsuite.so file, load it as an extension in PHP and call methods on it. As far as I can see any method call that was wrapped by SWIG works fine out of the box. Unfortunately I seem to be missing some symbols:
❯ nm crfsuite.so | grep crfsuite
U crfsuite_attribute_set
U crfsuite_create_instance
U crfsuite_create_instance_from_file
U crfsuite_create_instance_from_memory
U crfsuite_data_append
U crfsuite_data_finish
U crfsuite_data_init
00000000000281b3 T crfsuite_dictionary_create_instance
U crfsuite_evaluation_accmulate
U crfsuite_evaluation_finalize
U crfsuite_evaluation_init
U crfsuite_evaluation_output
0000000000256460 B crfsuite_globals
U crfsuite_instance_finish
U crfsuite_instance_init_n
U crfsuite_interlocked_decrement
U crfsuite_interlocked_increment
U crfsuite_item_append_attribute
U crfsuite_item_init
U crfsuite_item_init_n
I have generated the swig wrapper like so, using the default export.i:
swig -c++ -php7 -Icrfsuite/include -o export_wrap.cpp export.i
After that I've compiled the code with the following commands:
gcc -fpic -Icrfsuite/include -Icrfsuite/lib/cqdb/include -Iliblbfgs/include \
`php-config --includes` -c crfsuite.cpp export_wrap.cpp crfsuite/lib/crf/src/*.c \
crfsuite/swig/*.cpp crfsuite/lib/cqdb/src/cqdb.c crfsuite/lib/cqdb/src/lookup3.c \
liblbfgs/lib/*.c
gcc -shared *.o -o crfsuite.so
I've played with many gcc flags such as -L/usr/local/lib, -lcrfsuite, -Wl,-undefined,dynamic_lookup but stopped as they didn't seem to affect the result.
Running a basic example errors with the following message:
/usr/bin/php: symbol lookup error: /usr/lib/php/20170718/crfsuite.so: undefined symbol: crfsuite_data_init
The example correctly calls the Trainer constructor.
This all is quite new so I am lost between the many steps. Am I missing something obvious? Why are the symbols not linked correctly? And how can it be fixed?
Update:
I've set the $LD_LIBRARY_PATH and $LD_RUN_PATH to /usr/local/lib. That is also where the compiled and installed version of the crfsuite lies as a shared object:
ll $LD_LIBRARY_PATH/libcrfsuite.so
/usr/local/lib/libcrfsuite.so -> libcrfsuite-0.12.so
I have also changed the order of .o files. Didn't change anything.
CentOS release 6.7 (centos-release-6-7.el6.centos.12.3.x86_64)
kernel 2.6.32-573.22.1.el6.x86_64
We had successfully built the mongo-php-driver with the instructions found here
Last week I spun up a new instance, patched it via yum update, and tried to build - and I'm consistently getting this error now:
>> make install
Installing shared extensions: /usr/lib64/php/modules/
>> service php-fpm restart
Stopping php-fpm: [ OK ]
Starting php-fpm: [12-Apr-2016 14:38:39] NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/mongodb.so' - /usr/lib64/php/modules/mongodb.so: undefined symbol: bson_decimal128_from_string in Unknown on line 0
The build returns no errors, and seems to build the bson libraries as it goes:
checking for uint64_t... yes
... seen our uintptr_t in stdint.h (uint64_t too)
creating ./src/libbson/src/bson/bson-stdint.h : ___SRC_LIBBSON_SRC_BSON_BSON_STDINT_H
checking for int_least32_t... yes
checking for int_fast32_t... yes
..adding include stdint.h
... seen good stdint.h inttypes
... seen good uint64_t
... DONE ./src/libbson/src/bson/bson-stdint.h
* snip *
Build configuration:
CFLAGS : -g -O2
Extra CFLAGS : -pthread
Developers flags (slow) :
Code Coverage flags (extra slow) :
System mongoc : no
System libbson : no
LDFLAGS :
EXTRA_LDFLAGS :
MONGODB_SHARED_LIBADD : -lsasl2 -lssl -lcrypto -lrt
So far I have tried (and failed):
Deleting the mongodb.so file, repulling from github, and rebuilding
Descending into the src/libbson directory, building there, then
ascending and building again
Removing any packages containing bson (which include libbson and libbson-devel) using yum, in case it was building agains the wrong lib
My google-fu has failed me, and I can't find anything on SO about it. Anyone hit this kind of issue, or know a fix?
I need to interface libnetcdf with PHP. (the php-netcdf on google code is broken)
Here's netcdf.i :
%module netcdf
%{
/* Includes the header in the wrapper code */
#include "netcdf.h"
%}
/* Parse the header file to generate wrappers */
%include "netcdf.h"
I did :
gcc `php-config --includes` -fpic -c netcdf_wrap.c
gcc -shared netcdf_wrap.o -o netcdf.so
but when loading the extension in php, I get :
Unable to load dynamic library netcdf.so:
undefined symbol: ncerr in Unknown on line 0
It's the first time I try something like that. Am I missing something ?
ADDED -lnetcdf flag.
now, I got : undefined symbol: zend_error_noreturn. fixed replacing zend_error_noreturn by zend_error in netcdf_wrap.c
Your immediate problem is caused by not linking against libnetcdf. You need the -l flag for gcc to do so:
gcc -shared netcdf_wrap.o -o netcdf.so -lnetcdf
☝
php-netcdf at Google Code isn't broken, it's just unfinished and not maintained any more. However, one of the contributors, Santi Oliveras, seems to have managed to use it. Try to contact him, maybe he has some new code or something. Or feel free to take the project over.
P.S. I'm the author.