php-memcached-dev / php-memcached

memcached extension based on libmemcached library
Other
989 stars 323 forks source link

Set path to igbinary for compiling #398

Open osopolar opened 6 years ago

osopolar commented 6 years ago

I am on a managed server with limited options. I want to compile the PECL memcached extension with igbinary enabled:

./configure --with-libmemcached-dir=/custom-path/php-extensions/libmemcached-1.0.18 --enable-memcached-igbinary --with-php-config=/usr/local/bin/php71-config --disable-memcached-sasl

But this stops with the error checking for igbinary includes... configure: error: Cannot find igbinary.h as expected, because it does not know where to find the igbinary extension, which is in /custom-path/php-extensions/igbinary-2.0.6. Is there a way to provide that path to configure? If there is no way maybe it could be implemented similar to libmemcached, to allow the following command:

./configure --with-libmemcached-dir=/custom-path/php-extensions/libmemcached-1.0.18 --enable-memcached-igbinary --with-igbinary-dir=/custom-path/php-extensions/igbinary-2.0.6 --with-php-config=/usr/local/bin/php71-config --disable-memcached-sasl
osopolar commented 6 years ago

I also tried: env CFLAGS='-I/custom-path/php-extensions/igbinary-2.0.6' ./configure --with-libmemcached-dir=/custom-path/php-extensions/libmemcached-1.0.18 --enable-memcached-igbinary --with-php-config=/usr/local/bin/php71-config --disable-memcached-sasl, but same result, configure cannot find igbinary.h.

sodabrew commented 6 years ago

I'll take a look at this as soon as I can. Off the cuff, the igbinary headers should be relative to the php extensions directory, but I don't remember for sure.

osopolar commented 6 years ago

The problem is, that I am on a managed hosting, so I have limited rights. I can only write to the users home directory, I called that /custom-path/ above.

$ php-config  --extension-dir
/usr/local/lib/php/extensions/no-debug-non-zts-20020429
$ ls /usr/local/lib/php/extensions/no-debug-non-zts-20020429
ls: cannot access '/usr/local/lib/php/extensions/no-debug-non-zts-20020429': Permission denied
$ ls /usr/local/lib/php/extensions/
ls: cannot open directory '/usr/local/lib/php/extensions/': Permission denied
sodabrew commented 6 years ago

Ohhh now that makes sense! So you really do need to be able to pull both extensions from a custom directory, which PHP allows, and also to compile with headers from a custom directory, which php-memcached is giving you trouble with.

osopolar commented 6 years ago

Without looking into details, it may be done the same way as with libmemcached, providing an additional --with-igbinary-dir option. Maybe the same with msgpack (although currently I am not sure I I need that).

sodabrew commented 6 years ago

There is only --enable-memcached-igbinary and --enable-memcached-msgpack Both follow the same pattern to look for headers:

135   if test "$PHP_MEMCACHED_IGBINARY" != "no"; then
136     AC_MSG_CHECKING([for igbinary includes])
137     igbinary_inc_path=""
138
139     if test -f "$abs_srcdir/include/php/ext/igbinary/igbinary.h"; then
140       igbinary_inc_path="$abs_srcdir/include/php"
141     elif test -f "$abs_srcdir/ext/igbinary/igbinary.h"; then
142       igbinary_inc_path="$abs_srcdir"
143     elif test -f "$phpincludedir/ext/session/igbinary.h"; then
144       igbinary_inc_path="$phpincludedir"
145     elif test -f "$phpincludedir/ext/igbinary/igbinary.h"; then
146       igbinary_inc_path="$phpincludedir"
147     else
148       for i in php php4 php5 php6; do
149         if test -f "$prefix/include/$i/ext/igbinary/igbinary.h"; then
150           igbinary_inc_path="$prefix/include/$i"
151         fi
152       done
153     fi
154
155     if test "$igbinary_inc_path" = ""; then
156       AC_MSG_ERROR([Cannot find igbinary.h])
157     else
158       AC_MSG_RESULT([$igbinary_inc_path])
159     fi
160   fi

I'm wondering if it would make sense to allow per-extension lib dirs, or a single argument. There is already --includedir that is a standard argument for autoconf config scripts. I could pull that into the search pattern above.

osopolar commented 6 years ago

So how may the .configure command should look like with the custom path to igbinary? I also tried with --include=/custom-path/php-extensions/igbinary-2.0.6.

sodabrew commented 6 years ago

Nothing will work right now. I need to adjust the code and build a release.

sodabrew commented 5 years ago

Please try again with the php-memcached 3.1.2 release.