PHP 8 ioncube_loader failed loading - php

I am preparing a CentOS 7 server to migrate some services. Fresh install, so it's PHP 8 now. However (my required) IONCUBE loader fails to load:
# php -v
Failed loading /usr/lib64/php/modules/ioncube_loader_lin_8.1.so: /usr/lib64/php/modules/ioncube_loader_lin_8.1.so: undefined symbol: zend_incompatible_double_to_long_error
PHP 8.0.23 (cli) (built: Aug 30 2022 12:16:34) ( NTS gcc x86_64 )
Currect system is PHP 7.2 and I never had ioncube installation issues.
Even tried loading the _ts file.

You are loading 8.1 loader under PHP 8.0, which doesn't work, for PHP 8.0, you need loader for 8.0 which doesn't exist. Ioncube is usually skipping x.0 version of PHP, so, if you need loader, you need to upgrade to PHP 8.1.
Also, keep in mind that files are backward compatible only in mayor version of PHP. PHP 7.4, with loader for PHP 7.4 will execute files encoded with PHP 7.1 to 7.4. But, PHP 8.1 will not execute files encoded with PHP 7.4. If you need files which need to run on both, PHP 7.4 and PHP 8.1, you need bundled versions (options when encoding).

Related

PHP: pthreads not loading on PHP 8.1

I'm trying to add pthreads extension on PHP 8.1 TS and it doesn't seem to work, It's sayin that it is not installed while in fact it is.
PHP -v
PHP 8.1.10 (cli) (built: Aug 30 2022 18:05:49) (ZTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.1.10, Copyright (c) Zend Technologies
with Xdebug v3.1.5, Copyright (c) 2002-2022, by Derick Rethans
Here are the steps I used to install it ->
Get the latest release from here -> https://windows.php.net/downloads/pecl/releases/pthreads/
Extract php_pthreads.dll to /php/ext
Add extension=pthreads to php.ini
Extract pthreadVC2 in to /php
And when I try to install Laravel Horizon this is what I get ->
Root composer.json requires PHP extension ext-pthreads * but it is missing from your system. Install or enable PHP's pthreads extension.
pthreads is not available for PHP 8.1
PHP extensions need to be compiled against the correct version of PHP, because they interact directly with code that is only guaranteed stable within one annual release (e.g. 7.0.1 and 7.0.2 are guaranteed compatible, but 7.0.0 and 7.1.0 are not). They also generally require significant source code changes between major releases, i.e. an extension written for PHP 7.0 is reasonably likely to be compilable against PHP 7.4, but not against PHP 8.0.
If you look at the downloads for an earlier version of pthreads, you'll see that the version of PHP is included in the filename - pthreads 2.0.10 has builds available for 5.3, 5.4, 5.5, and 5.6. The last release listed, 3.1.6, only has two files available, both built for PHP 7.0.
Looking on Github, version 3.1.6 was tagged in Feb 2016, 10 months before PHP 7.1. There is a version 3.2.0 on Github, which mentions support for PHP 7.2, but this does not appear on the PECL page for the extension, which features a prominent banner:
This package is not maintained anymore and has been superseded.
Specifically, it was discontinued by the author in favour of a new extension called "parallel". Unfortunately, that extension has not yet had a release which supports PHP 8.x either.
you can use phpinfo(); method that will display all php extension you have install and make sure that you installed it in right php.ini file maybe that will fix your problem and you can also restart your localhost

PHP OCI8 extensions not working with PHP 7 64 bit

I have installed APACHE 2.4 x64 and PHP7 x64 and download PHP OCI 64bit libraries but the problem is that whenever I run PHP script from cli it says
PHP Startup: Unable to load dynamic library
'E:\software\server\php-7.0.11-Win32-VC14-x64\ext\php_oci8_11g.dll' -
%1 is not a valid Win32 application
Also when I invoke the webapplication from URL it says
Call to undefined function oci_pconnect()
The OCI extension I downloaded are also 64bit. Here is the link:
http://windows.php.net/downloads/pecl/releases/oci8/2.1.2/php_oci8-2.1.2-7.0-ts-vc14-x64.zip
Can someone guide on this problem.
You've probably mixed TS (thread safe) and NTS (non-thread safe) versions. These will not work together. Find out more about PHP thread safety here.
PHP 7.0.11 NTS x64, OCI8 2.1.2 NTS x64, and InstantClient 11.2.0.4.0 x64 work perfectly well together (I've just downloaded these three files and tested them in a fresh Win2K8 environment).
Remember to install the latest VC14 runtime (Visual Studio 2015) and to modify your PATH system environment variable to include the directories of PHP and the InstantClient, e.g. C:\php;C:\instantclient_11_2.

How to find which version of libssh2 is required for my php version (on Windows)

When I check my php version I get the following warnings:
PHP Warning: PHP Startup: ssh2: Unable to initialize module
Module compiled with module API=20121212
PHP compiled with module API=20131226
These options need to match
in Unknown on line 0
I'm trying to understand which versions work together and how I can get hold of the correct version to setup PHP with SSH2. I have been able to find the .tar.gz versions of libssh from places like the following:
https://www.rpmfind.net/linux/RPM/remi/enterprise/6/x86_64/php56-php-pecl-ssh2-0.12-4.el6.remi.x86_64.html
The problem is I am using a Windows machine and not Linux. Does anyone know whether I can get the same libssh version for Windows? Or do I have to downgrade PHP to the same level as ssh2? Or is it nothing to worry about it and just a quirk of Windows?
Here are some details that might be of use:
OS: Windows 10 (x64)
PHP Version: PHP 5.6.15 (cli) (built: Oct 29 2015 12:39:50)
Microsoft Visual C++ 2015 Redistributable (x64) 11.0.61030
Server version: Apache/2.4.17 (Win64)
Apache Lounge VC11 Server built: Oct 13 2015 11:37:51
In addition... I've found the version of the ssh2 zip that I downloaded. It was 5.5 Thread Safe (TS) x64 from: https://pecl.php.net/package/ssh2/0.12/windows
So, I guess that means I need to downgrade my PHP to 5.5 for this to work properly. Is that correct or is there a better way?
I've found a solution to the problem. As stated in the OP the problem was that the PHP module was a later version than the SSH2 module. The question was how to find the versions that would work with the setup stated. This proved to be quite tricky because there were more systems that needed to be integrated than I first thought. I falsely assumed that the latest versions would all play nice together.
As I am running Windows 10 64-bit I wanted to get the stable version of PHP that runs against this - that would be PHP 7. As stated here: http://windows.php.net/download/. Initially I downloaded PHP 7.0 but this didn't play nicely with another module that I wanted to install, which was MongoDB.
When I looked into MongoDB I realised that there wasn't a driver for PHP 7.0 yet so the latest one I could get was PHP 5.6. This meant that I had to settle for an "experimental" 64-bit version of PHP. So I made the shift and everything was playing nice until I decided that I wanted to get Composer so that I could manager my PHP dependencies.
When I tried to intall Composer using the Windows installer it failed with an unknown exception and suggested I try from the command line to get a better error response. So I duly did and the error stated that the ssh2 module was not compatible with PHP 5.6.
That eventually brought me to ask the question on stackoverflow.
After some more digging into what versions of ssh2 there are I was brought to the following page: http://windows.php.net/downloads/pecl/releases/ssh2/0.12/
This told me that the latest version of PHP that was compatible with the SSH2 extension was PHP 5.5. So... it looks like the solution was to downgrade to version 5.5.
When I started looking for the new (old) version to download I came across this wonderful bundle package site: https://www.apachelounge.com/viewtopic.php?t=6123
From there I could download this version (https://phpdev.toolsforresearch.com/php-5.5.20-Win32-VC11-x64.zip) and it would contain all the modules that I needed in the correct version.
So, in conclusion, a little more up-front analysis into what versions play nice together would have helped or understanding that the Apache Lounge has all the versions that work together in a nice tidy bundle.

PHP APC Cache for PHP 5.4.22 Win 7

I need to install APC cache for
Windows 7
Php 5.4.22
can anyone provide me with a binary ? or instructions on how to build one for windows for the specific version of PHP
I see there are binaries available for PHP 5.4.6,5.4.7 etc but not able to find one for 5.4.22
i tried the binaries for 5.4.6 and 5.4.7 but I runtime errors saying that the server stopped working due to an error in the apc.dll.
There is no specific error message
How to install: http://docs.moodle.org/24/en/Installing_APC_in_Windows
Download locations:
http://dev.freshsite.pl/nc/php-accelerators/apc/download/
but first you should check what PHP you have installed (You can find it in phpinfo();):
PHP 5.4.6
PHP 5.4.6 VC9
PHP 5.4.6 nts
PHP 5.4.6 VC9 nts

MongoDb php extension not loading

I'm trying to load the MongoDb extension for php on a Windows 7 64 bit PC, running XAMPP with Apache 2.0 and PHP 5.3.5, compiler version VC6. I started out with this tutorial, and have also tried the extensions that the php documentation suggested. MongoDb itself is running fine, and shell commands seem to work.
At the moment I have:
Added extension=php_mongo.dll to my php.ini file.
Put the VC6 version of php_mongo.dll (from the following download page, suggested by the PHP documentation) in the php/ext folder.
Restarted my Apache server.
I have also tried php_mongo.dll files form Stealth's github, but they didn't seem to work either.
When restarting Apache, I don't get any errors, but I can't find anything on MongoDb in phpinfo(), and the Mongo class is not recognised either.
Any ideas of what might be wrong? Let me know if you need more info.
The problem might be incorrect version of extension. Try different versions downloaded from here: http://pecl.php.net/package/mongo/1.6.4/windows
Use Bitnami WAMP Stack instead of XAMPP it comes preloaded php_mongo.dll driver installed and no need to configure php.ini file
There is no official MongoDB Driver released for PHP7. So it would be better to download the recommended PHP version 5.5.30(currently) offered by Bitnami Wamp Stack.
There might be two reasons:
First one is as #Sadd suggested. Your mongodb extension should be loaded after what you have done so its very likely that you have enabled extension in wrong file. And yes, there are two such similar files (named php.ini-development and php.ini-production on windows computers), so make sure to enable it in php.ini file and run the following code echo extension_loaded("mongodb") ? "loaded\n" : "not loaded\n"; and you should see loaded on screen.
If you still don't see it, then the second thing you can do is to check whether the version is right or not. You can check your phpinfo() for your php version and then put the right versioned dll file in ext folder. In this, you can have to check whether your php is ts or nts and second one is whether your php is x64 or x86. I hope you are good to go after one or both of the changes.
This was driving my crazy until I looked closely at my PHP version:
$ php -v
PHP 7.4.1 (cli) (built: Dec 17 2019 19:23:59) ( NTS Visual C++ 2017 x64 )
Notice that it says PHP 7.4.1 and NTS and x64? This means that when I download from PECL, I need version 7.4 Non Thread Safe (NTS) x64 or it won't run correctly.
If the correct version of module is not added, an error is thrown.
[PHP Warning: PHP Startup: Unable to load dynamic library 'php_mongodb.dll' (tried: C:\xampp\php\ext\php_mongodb.dll (The specified module could not be found), C:\xampp\php\ext\php_php_mongodb.dll.dll (The specified module could not be found)) in Unknown on line 0]
When downloading the dll extension from https://pecl.php.net/package/mongodb, make sure that NTS (Non Thread Safe) or TS (Thread Safe) is chosen according to what shown from php -v command.
$ php -v
PHP 8.1.7 (cli) (built: Jun 7 2022 21:45:53) (ZTS Visual C++ 2019 x64)
Although here it shows ZTS, TS version can be used in this case.

Categories