How to inegrate ioncube(or another extenstion) into phpbrew php version? - php

I'm using phpbrew for switching between different versions of php. And now I can't install ioncube as php extension.
What I have already done:
Download from http://www.ioncube.com/loaders.php my version of extension (Linux 64 tar.gz v6.0.9 2017-1-26)
Unpack all and put ioncube_loader_lin_5.6.so to /home/kpot/.phpbrew/php/php-5.6.24-last/lib/php/extensions/debug-zts-20131226
Add extension=/home/kpot/.phpbrew/php/php-5.6.24-last/lib/php/extensions/debug-zts-20131226/ioncube_loader_lin_5.6.so in php.ini
Restart server with sudo service apache2 restart
When apply php -v got this PHP Warning: PHP Startup: Unable to load dynamic library '/home/kpot/.phpbrew/php/php-5.6.24-last/lib/php/extensions/debug-zts-20131226/ioncube_loader_lin_5.6.so' - /home/kpot/.phpbrew/php/php-5.6.24-last/lib/php/extensions/debug-zts-20131226/ioncube_loader_lin_5.6.so: undefined symbol: executor_globals in Unknown on line 0
after phpinfo() can't find anything associated with ioncube
Additional information:
uname -a
Linux KpoT 4.4.0-75-generic #96~14.04.1-Ubuntu SMP Thu Apr 20 11:06:30 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
php -i | grep extension_dir
extension_dir => /home/kpot/.phpbrew/php/php-5.6.24-last/lib/php/extensions/debug-zts-20131226 => /home/kpot/.phpbrew/php/php-5.6.24-last/lib/php/extensions/debug-zts-20131226
phpbrew - 1.21.6

First of all. When you unpack your archive with ioncube, pay attension to files with _ts at the end. In my case I have php with thread safe enabled(phpinfo()), so you must choose exactly that files.
Second problem occurs when php was compiled with debug. You must recompile your php without it.

Related

PHP Warning - PHP Startup: Unable to load dynamic library 'imagick.so'

Has anyone come across this warning before? Any files I should check other than php.ini or 00-ioncube.ini? Those look to be in good order.
$ php -v
PHP Warning: PHP Startup: Unable to load dynamic library 'imagick.so' (tried: /usr/lib64/php/modules/imagick.so (libMagickWand.so.5: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/imagick.so.so (/usr/lib64/php/modules/imagick.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 7.3.31 (cli) (built: Sep 21 2021 10:24:03) ( NTS )
Operating System:
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-1160.42.2.el7.x86_64
Architecture: x86-64
I upgraded PHP from version 7.1 to 7.3 on using these steps:
php -v
sudo yum install epel-release
yum --enablerepo=remi-php73 install php
php -v
systemctl restart httpd
I only see one php.ini file loaded in /etc/
Check how was the imagick extension was installed:
rpm -qf /usr/lib64/php/modules/imagick.so
It looks like it is not provided by a RPM, nor built for the proper PHP version you are running (libMagickWand.so.5 is also an old version).
For a proper configuration / installation, see the Wizard instructions
At least I recommend you enable the remi-php73 repository permanently, to ensure all extensions are taken from it.
yum-config-manager --enable remi-php73
Then you can install the imagick extension, or any other extension you need
yum install php-imagick
Notice, in this repository you have the choice between 2 variants of this extension, above command will pick one among:
php-pecl-imagick-im6 build with ImageMagick version 6 (libMagickCore-6.Q16.so.7, libMagickWand-6.Q16.so.7)
php-pecl-imagick-im7 build with ImageMagick version 7 (libMagickCore-7.Q16HDRI.so.10, libMagickWand-7.Q16HDRI.so.10)
APIs are slightly different.

Centos 8 PHP 56

I am trying to install php 5.6 on centos 8. I understand it is no longer supported (eol), but due to an old project, it needs it.
I have tried:
sudo dnf --enablerepo=remi install php56
Installs with no issue, hitting localhhost/ throws an error
Running php --version gives me an error
bash: /usr/bin/php: No such file or directory
Howver running php56 --version works.
How do i make it such that any reference to php will use php56?
The Software Collections are designed for parallel installation of multiple versions. So you have to enable the collection of the version you want.
Example:
$ module load php80
$ php -v
PHP 8.0.9 (cli) (built: Jul 29 2021 12:53:58) ( NTS gcc x86_64 )
$ module load php56
$ php -v
PHP 5.6.40 (cli) (built: Jun 28 2021 00:00:00)
For web server, if only one version is installed, it will be used for all pages.
If multiple versions are installed you have to set the proper handler (socket path) for each vhost / project / directory to use the wanted FPM backend.
How do i make it such that any reference to php will use php56?
If you really need only one version, you can also install the php56-syspaths package, which provides /usr/bin/php (a symlink)

Problems building and using mssql.so php extension, AMPPS server on MAC OSX

I think what I need to know is how to specify the build architecture when building .php extensions on OSX.
What are the likely architectures that I should try first, and how to specify them?
The details:
I am having trouble building a working mssql.so php extension for my server.
I have been using an AMPPS server on mac to serve php based websites, accessing MySQL databases.
Now I need to connect to an MSSQL database. The AMPPS php installation does not include the mssql extension so when I try to use mssql_connect() I get the following error.
Call to undefined function `mssql_connect()` in /Applications/AMPPS/www/test.php
I think I need to add mssql.so to the php/lib/extensions/ext folder and then add
extension=mssql.so
to my php.ini file.
To build mssql.so I have found a couple of online tutorials that both use Freetds:
http://lkrms.org/php-with-freetds-on-os-x-mavericks/#comment-82521
http://blog.benjaminwalters.net/?p=10
I used home brew to install autoconf:
brew instal autoconf
Then I downloaded and installed freetds:
./configure --prefix=/usr/local/freetds --sysconfdir=/usr/local/freetds/conf/freetds --disable-libiconv --disable-odbc
make
sudo make install
Freetds was installed at /usr/local/freetds. Then I downloaded php. I have tried this with all the versions available for download 5.6.2, 5.5.18, 5.4.32 and 5.3.29. 5.3.29 had a problem and I could not generate mssql.so.
All of the other versions successfuly produced mssql.so using the following method:
Unzip package in downloads folder
cd php-5.4.17/ext/mssql
phpize
./configure --with-php-config=/usr/bin/php-config --with-mssql=/usr/local/freetds
make
Then I copy the generated mssql.so to /Applications/AMPPS/php-5.4/lib/extensions/ext and add this to the php.ini file.
extension=mssql.so
I restart the apache server and view the error / log file which has the following error:
PHP Warning: PHP Startup: Unable to load dynamic library '/Applications/AMPPS/php-5.4/lib/extensions/ext/mssql.so' - dlopen(/Applications/AMPPS/php-5.4/lib/extensions/ext/mssql.so, 9): no suitable image found. Did find:\n\t/Applications/AMPPS/php-5.4/lib/extensions/ext/mssql.so: mach-o, but wrong architecture in Unknown on line 0
So it seems like I have built mssql.so for the wrong architecture?
I looked at the terminal output when I configure the "make" for mssql.so and found the following indicating the architecture it is being made for:
checking build system type... i386-apple-darwin13.1.0
checking host system type... i386-apple-darwin13.1.0
checking target system type... i386-apple-darwin13.1.0
So it looks like I made it for i386. This is where I start to get confused.
After make the terminal instructs me to run "make test", I do this and receive the following output:
=====================================================================
PHP : /usr/bin/php PHP_SAPI : cli PHP_VERSION : 5.4.24
ZEND_VERSION: 2.4.0 PHP_OS : Darwin - Darwin myMac13.1.0 Darwin
Kernel Version 13.1.0:
Thu Jan 16 19:40:37 PST 2014;
root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64
INI actual : /Users/user/downloads/php-5.6.2/ext/mssql/tmp-php.ini More .INIs :
CWD : /Users/user/Downloads/php-5.6.2/ext/mssql Extra dirs :
VALGRIND:Notused
===================================================================TIME START 2014-10-26 11:53:50
=====================================================================
No tests were run. It does not say why no tests were run which is frustrating. It mentions x86_64 which is not i386.
I tried to check what architecture my system is to verify if it should be i386 or x86_64.
I did this with uname and arch as follows:
uname -p
i368
uname -m
x86_64
arch
i386
So my machine hardware is x86_64 (uname -m) but the processor architecture is i386 (uname -p) I don't understand how these can be different or what the implications of this are.
So have I built mssql.so for the wrong architecture or have I done something else wrong? If I have built it for the wrong architecture then how do I configure it to build for the correct one?
Many thanks for any help with this.

PHP not loading http.so

I updated my Mac to OS X Mavericks (10.9) and have had to setup PHP again, along with PECL OAuth.
When I verify my install with the command php -v, I am getting an error:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20100525/http.so' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20100525/http.so, 9): Symbol not found: _php_persistent_handle_abandon
Referenced from: /usr/lib/php/extensions/no-debug-non-zts-20100525/http.so
Expected in: flat namespace
in /usr/lib/php/extensions/no-debug-non-zts-20100525/http.so in Unknown on line 0
PHP 5.4.17 (cli) (built: Aug 25 2013 02:03:38)
Has anyone else come across this? Any idea what the issue could be?
I worked it out....had to install pecl_http-1.7.6.
# 1. Uninstall the current version with this command:
pecl uninstall pecl_http
# 2. Install an older version, at least until latest is figured out on Mac OSX 10.8+
pecl install pecl_http-1.7.6
I have fixed this issue by editing php.ini.
My pecl install pecl_http mixed it up and put few extension= lines on top of my php.ini in wrong order. The http.so has to be below propro.so and raphf.so according to dependencies.

FFMPEG on Fedora but PHP Compilation confliction

I have running Xampp with PHP5.5 on Fedora from Apache Friend, with default settings what the installer package do on Linux.
When I install FFMPEG successfully and try to load from php.ini it always says:
*
11-Oct-2013 14:05:51 Europe/Berlin] PHP Warning: PHP Startup: ffmpeg: Unable to initialize module
Module compiled with module API=20060613
PHP compiled with module API=20121212
These options need to match
in Unknown on line 0
*
The only thing which is confusing me is that when I did phpize even that I already installed xampp server which means I have PHP running. FFMPEG phpize did not work and I had to install php-devel. Does that mean that FFMPEG is configured with PHP, other than the installed with XAMPP? I am not sure what is happening. Whatever I do I always receive this error message in php_error_log file.
It is amazing :) that I just run below command to see what version of PHP is, I have and below are the results which are shocking one because I am in a feeling that I have PHP 5.5 installed and running from XAMMP.
[root#localhost ~]# php -v
PHP 5.2.6 (cli) (built: May 8 2008 08:53:44)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
How can I get this covered that if I simple install XAMPP server on linux and want to install and configure FFMPEG along with?
My guess would be that the versions of php and the module you installed do not match. So run make sure both packages are installed from the same source and are both current.
EDIT: According to the XAMPP site, Fedora is not supported, they specify Ubuntu, SuSE, RedHat, Mandrake and Debian. So I would make sure you do not use the php package provided by Fedora. Or (if you have the liberty), choose a different OS.

Categories