install apcu PHP extension in azure webapp linux container - php

I'm trying to start existing php application in azure App Service.
Application is using apcu extension.
I'm trying to istall extension to the app service.
I connect via ssh and try to install the extension via
pecl install apcu
But I'm getting following error:
creating libtool
appending configuration tag "CXX" to libtool
configure: patching config.h.in
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/bash /tmp/pear/temp/pear-build-rootdX8M2c/apcu-5.1.19/libtool --mode=compile cc -D_GNU_SOURCE -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/tmp/pear/temp/apcu -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootdX8M2c/a
pcu-5.1.19/include -I/tmp/pear/temp/pear-build-rootdX8M2c/apcu-5.1.19/main -I/tmp/pear/temp/apcu -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/u
sr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/apcu/apc.c -o apc.lo
cc -D_GNU_SOURCE -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/tmp/pear/temp/apcu -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootdX8M2c/apcu-5.1.19/include -I/tmp/pear/temp/pear-build-rootdX8M2c/apcu-5.1.19/main -I/tmp
/pear/temp/apcu -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g
-O2 -c /tmp/pear/temp/apcu/apc.c -fPIC -DPIC -o .libs/apc.o
In file included from /tmp/pear/temp/apcu/apc.c:32:
/tmp/pear/temp/apcu/apc.h:64:10: fatal error: config.h: No such file or directory
#include <config.h>
^~~~~~~~~~
compilation terminated.
make: *** [Makefile:194: apc.lo] Error 1
ERROR: `make' failed

I think it's a bug in php 7.4 version. I switch it to 7.2 and 7.3, and it works for me.
Tips
If you insist on using version 7.4, you can try to install apcu and then switch the version back to 7.4. I haven't tested this solution with a project, it's just an alternative solution, I hope it helps you.
You can raise a support ticket to confirm this.
Change the php version to 7.2 or 7.3 first,
and run command pecl install apcu .
it works for me.
Step 1. Change php version.
Step 2. Open SSH.
Step 3. Run command pecl install apcu

Related

PHP unable to compile PDO_IBM on CENTOS8

I have a linux server CentOS Linux release 8.5.2111 .
I'm trying to compile PDO_IBM extension .
I have php 7.4.
I have installed ibm driver package
tar -xvzf ibm_data_server_driver_package_linuxx64_v11.5.tar.gz
mv dsdriver /opt/ibm/
cd /opt/ibm/dsdriver
./installDSDriver
After that
 export IBM_DB_HOME=/opt/ibm/dsdriver
pecl install ibm_db2
Everything is good: I can see the new ext with pecl list
After that (PDO_IBM 1.5.0)
pecl download PDO_IBM
cd to PDO dir
phpize --clean
phpize
./configure
make
make install
The first error is
/bin/sh /home/PDO_IBM-1.5.0/libtool --mode=link cc -DPHP_ATOM_INC -I/home/PDO_IBM-1.5.0/include -I/home/PDO_IBM-1.5.0/main -I/home/PDO_IBM-1.5.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/include -DHAVE_CONFIG_H -g -O2 -o pdo_ibm.la -export-dynamic -avoid-version -prefer-pic -module -rpath /home/PDO_IBM-1.5.0/modules pdo_ibm.lo ibm_driver.lo ibm_statement.lo -Wl,-rpath, -L -ldb2
libtool: error: require no space between '-L' and '-ldb2'
If i try to edit MakeFile and correct the space
libtool: error: cannot determine absolute directory name of '-ldb2'
Where I'm wrong ?
Find the solution: the compiler expect to found lib X64 file in /opt/ibm/lib64 but from default dsdriver setup create two folder: lib32 for X32 and lib for X64. just create a copy and the compiler works well.
Also i need to add:
./configure --with-pdo-ibm=/opt/ibm/dsdriver

Azure + Debian + PHP8.1 trying to install sqlsrv_pdo and getting "error: `make` failed;

Trying to deploy a PHP Azure "App Service" app, which connects to a SQL Server database
I have to add the sqlsrv and sqlsrv_pdo packages by running pecl install pdo_sqlsrv and pecl install sqlsrv`
Other threads have mentioned adding apt-get install unixodbc-dev, I have done so, but it does not help
Here is the error I'm getting below
creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by g++... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC
checking if g++ PIC flag -fPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking whether the g++ linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
(cached) (cached) checking how to hardcode library paths into programs... immediate
configure: patching config.h.in
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/bash /tmp/pear/temp/pear-build-rootiNpTPo/pdo_sqlsrv-5.10.1/libtool --mode=compile g++ -I. -I/tmp/pear/temp/pdo_sqlsrv -I/tmp/pear/temp/pear-build-rootiNpTPo/pdo_sqlsrv-5.10.1/include -I/tmp/pear/temp/pear-build-rootiNpTPo/pdo_sqlsrv-5.10.1/main -I/tmp/pear/temp/pdo_sqlsrv -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/tmp/pear/temp/pdo_sqlsrv/shared/ -DHAVE_CONFIG_H -std=c++11 -D_FORTIFY_SOURCE=2 -O2 -fstack-protector -I/usr/local/include/php/ext -std=c++11 -DZEND_COMPILE_DL_EXT=1 -c /tmp/pear/temp/pdo_sqlsrv/pdo_dbh.cpp -o pdo_dbh.lo -MMD -MF pdo_dbh.dep -MT pdo_dbh.lo
g++ -I. -I/tmp/pear/temp/pdo_sqlsrv -I/tmp/pear/temp/pear-build-rootiNpTPo/pdo_sqlsrv-5.10.1/include -I/tmp/pear/temp/pear-build-rootiNpTPo/pdo_sqlsrv-5.10.1/main -I/tmp/pear/temp/pdo_sqlsrv -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/tmp/pear/temp/pdo_sqlsrv/shared/ -DHAVE_CONFIG_H -std=c++11 -D_FORTIFY_SOURCE=2 -O2 -fstack-protector -I/usr/local/include/php/ext -std=c++11 -DZEND_COMPILE_DL_EXT=1 -c /tmp/pear/temp/pdo_sqlsrv/pdo_dbh.cpp -MMD -MF pdo_dbh.dep -MT pdo_dbh.lo -fPIC -DPIC -o .libs/pdo_dbh.o
In file included from /tmp/pear/temp/pdo_sqlsrv/php_pdo_sqlsrv_int.h:23,
from /tmp/pear/temp/pdo_sqlsrv/pdo_dbh.cpp:24:
/tmp/pear/temp/pdo_sqlsrv/shared/core_sqlsrv.h:48:10: fatal error: config.h: No such file or directory
48 | #include "config.h"
| ^~~~~~~~~~
compilation terminated.
make: *** [Makefile:205: pdo_dbh.lo] Error 1
ERROR: `make' failed
I was expecting the pecl package to run... actually I was expecting the Microsoft App Service linux box to support MS Sql Server by default, but you get what I'm saying
Okay, after 3 days of messing around with this, I found a solution
Azure doesn't have sudo command... but in order to install pecl packages, you MUST run su -
su -
pecl install pdo_sqlsrv
pecl install sqlsrv
cp /home/site/wwwroot/azure/custom_php.ini /usr/local/etc/php/conf.d/;
exit;
service nginx reload;
The contents of my custom_php.ini file are
extension=pdo_sqlsrv.so
extension=sqlsrv.so
NOTE:
For Azure, I had to create a .sh file in my project and run all this from Home > My App > Configuration > General Settings > Startup Command - so that it'd be ran every time a new server is instantiated
NOTE 2: I also had to make changes to the nginx /etc/nginx/sites-enabled/default file, which moved the root of my project to /home/site/wwwroot/public - but that's laravel specific

fatal error: 'php.h' file not found when running make on xdebug in MacOS

I try to get Xdebug ready on my Mac to use for PHP development, I inputed the output of phpinfo() in the official Wizard and followed the instructions. phpize worked, running ./configure also works, but I'm stuck at the make command which outputs:
Makefile:230: warning: overriding commands for target `test'
Makefile:134: warning: ignoring old commands for target `test'
/bin/sh ~/Downloads/xdebug-3.0.4/xdebug-3.0.4/libtool --mode=compile cc -I. -I~/Downloads/xdebug-3.0.4/xdebug-3.0.4 -DPHP_ATOM_INC -I~/Downloads/xdebug-3.0.4/xdebug-3.0.4/include -I~/Downloads/xdebug-3.0.4/xdebug-3.0.4/main -I~/Downloads/xdebug-3.0.4/xdebug-3.0.4 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I~/Downloads/xdebug-3.0.4/xdebug-3.0.4/src -DHAVE_CONFIG_H -g -O2 -c ~/Downloads/xdebug-3.0.4/xdebug-3.0.4/xdebug.c -o xdebug.lo
mkdir .libs
cc -I. -I~/Downloads/xdebug-3.0.4/xdebug-3.0.4 -DPHP_ATOM_INC -I~/Downloads/xdebug-3.0.4/xdebug-3.0.4/include -I~/Downloads/xdebug-3.0.4/xdebug-3.0.4/main -I~/Downloads/xdebug-3.0.4/xdebug-3.0.4 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I~/Downloads/xdebug-3.0.4/xdebug-3.0.4/src -DHAVE_CONFIG_H -g -O2 -c ~/Downloads/xdebug-3.0.4/xdebug-3.0.4/xdebug.c -fno-common -DPIC -o .libs/xdebug.o
~/Downloads/xdebug-3.0.4/xdebug-3.0.4/xdebug.c:25:10: fatal error: 'php.h' file not found
#include "php.h"
^~~~~~~
1 error generated.
make: *** [xdebug.lo] Error 1
I tried to install the php-dev package through brew, but it does not exist. How to fix this issue?
It is because OSX doesn't install the PHP headers that extensions require when they are being compiled. I think you're using the OSX provided PHP.
You should instead use homebrew to install PHP, which would also install the headers, and then you can install Xdebug (and other extensions).
There are excellent instructions in this answer.

PECL extensions installation fails after update MacOS to Mojave (10.14)

I use my Mac to develop three projects: a Android app, a iPhone app, and a Symfony project.
My Symfony project uses Redis and APCu extensions. This was installed (6 months ago) via PECL using:
sudo pecl install redis
and
sudo pecl install apcu
Yesterday, after update my mac to Mojave, and try to start my PHP's built-in Web Server as usual, I get the following error:
Attempted to load class "Redis" from the global namespace. Did you
forget a "use" statement?
I also noticed that php.ini was removed during the installation, so I used the php.ini-previous to generate the php.ini again.
Also re-installed the Command Line Tools (was removed during installation):
xcode-select --install
And finally, I tried to install the redis extenison via PECL, again:
sudo pecl install redis
This time PECL throws an error:
creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/sh /private/tmp/pear/temp/pear-build-root1vQ0zO/redis-4.1.1/libtool --mode=compile cc -I. -I/private/tmp/pear/temp/redis -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-root1vQ0zO/redis-4.1.1/include -I/private/tmp/pear/temp/pear-build-root1vQ0zO/redis-4.1.1/main -I/private/tmp/pear/temp/redis -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/temp/redis/redis.c -o redis.lo
mkdir .libs
cc -I. -I/private/tmp/pear/temp/redis -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-root1vQ0zO/redis-4.1.1/include -I/private/tmp/pear/temp/pear-build-root1vQ0zO/redis-4.1.1/main -I/private/tmp/pear/temp/redis -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/temp/redis/redis.c -fno-common -DPIC -o .libs/redis.o
In file included from /private/tmp/pear/temp/redis/redis.c:27:
/private/tmp/pear/temp/redis/common.h:1:10: fatal error: 'php.h' file not found
#include "php.h"
^~~~~~~
1 error generated.
make: *** [redis.lo] Error 1
ERROR: `make' failed
How can solve this issue?
Running the following command will reinstall the developer tools header files and fix the issue.
$ sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
You'll want to do
$ locate php.h
results should be something like:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/php/main/php.h
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/php/main/php.h
Next, you'll want to disable SIP so you can create a folder in /usr/include and symlink the php dev dependencies to this folder, You have to boot into recovery to do this; restart you machine then hold cmd + R while it restarts, select terminal from the utilities menu.
run # csrutil disable && shutdown -r now
this will disable SIP and restart your machine.
Once your booted in, you'll want to create that folder we talked about like so sudo mkdir /usr/include
next we create a symlink to where the php dev files are located
$ ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/php /usr/include
You'll still have to enable SIP back, so boot back into recovery mode this time around you'll run
# csrutil enable && shutdown -r now, and thats it.

Phalcon install error on Centos : make: *** [phalcon.lo] Error 1

I install all dependencies / requires for phalcon , and pull from git then when i run ./install i got theese errors :
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
/bin/sh /root/down/cphalcon/build/64bits/libtool --mode=compile gcc -I. -I/root/down/cphalcon/build/64bits -DPHP_ATOM_INC -I/root/down/cphalcon/build/64bits/include -I/root/down/cphalcon/build/64bits/main -I/root/down/cphalcon/build/64bits -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DPHALCON_RELEASE -DHAVE_CONFIG_H -march=native -mtune=native -O2 -finline-functions -fomit-frame-pointer -fvisibility=hidden -c /root/down/cphalcon/build/64bits/phalcon.c -o phalcon.lo
libtool: compile: gcc -I. -I/root/down/cphalcon/build/64bits -DPHP_ATOM_INC -I/root/down/cphalcon/build/64bits/include -I/root/down/cphalcon/build/64bits/main -I/root/down/cphalcon/build/64bits -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DPHALCON_RELEASE -DHAVE_CONFIG_H -march=native -mtune=native -O2 -finline-functions -fomit-frame-pointer -fvisibility=hidden -c /root/down/cphalcon/build/64bits/phalcon.c -fPIC -DPIC -o .libs/phalcon.o
/root/down/cphalcon/build/64bits/phalcon.c: In function ‘phalcon_array_unshift’:
/root/down/cphalcon/build/64bits/phalcon.c:6058: error: void value not ignored as it ought to be
make: *** [phalcon.lo] Error 1
What can i do ?
Make sure your PHP is 5+ then check if you have the latest version of these packages: php-devel php-mysqlnd gcc libtool.
If still no luck try to using PHP 5.5 and install the packages: php55-devel php55-mysqlnd.
And finally if you believe that the problem isn't with your machine configurations, checkout to branches 1.3.2 or 1.3.3 and try to install again.
Hopefully you got this figured out by now, but I just ran into the same issue. I'm using Ubuntu through VirtualBox.
The issue was that GCC ran out of memory, so I changed the allocated memory from 512MB to 1024MB, then I ran it again successfully.

Categories