I wrote an extension with C++ for php on windows. I build multiple different versions:
php 5: with a MSVC11 compiler, linked with php5ts.lib, thread safe and it works fine
php 7: with a MSVC14 compiler, linked with php7ts.lib, thread safe, but it didn't work
The php 7 version gives me
Warning: PHP Startup: Unable to load dynamic library 'C:/openserver/ospanel/modules/php/PHP-7.0/ext/module_php_7.0.21_TS.dll' - The specified module could not be found.
in Unknown on line 0
PHP 7.0.21 (cli) (built: Jul 5 2017 13:31:19) ( ZTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
I tried to change extension folder, rename file, nothing helps. Library was built without any error. I double checked that it exists.
P.s: I know there is a difference between php5 and php7 api, i have #ifdef for this, so it's not a problem. Also we have successful build of this module with php7 on linux.
I resolved an issue. It was a mistake in build script. php5ts.lib and php7ts.lib was included at same time. I deleted php5ts.lib from linker and now it works as expected.
Related
I have been having a option for a few days. When I try to run a PHPUnit test I get a message saying failed to load Xdebug. I have tried to reinstall, change filepaths etc but I am getting nowhere. Hoping somebody can help me out :)
PHP 7.4.3 (cli) (built: Oct 6 2020 15:47:56) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies
Failing loading xxxx.dll is an indication that PHP can't load the extension file. This could have several reasons:
The file does not exist → check if it does
The permissions on the file are incorrect → check the permissions
The file is of "the wrong extension type". Which can be either:
the extension is for the wrong wrong PHP version
the extension is of the wrong bitness (32 vs 64bit)
the wrong TS variant (NTS vs ZTS)
the wrong "debug mode" build of PHP (either debug, or nodebug)
The API type (except for bitness, which you can check with echo PHP_INT_SIZE;; 4 is 32bit, and 8 is 64bit) is reflected in the "Zend Extension Build" output in php -i or phpinfo().
You can use Xdebug's wizard to tell you which exact file to download for your specific set-up.
Yesterday I tried to install php-gd for php7.2.15 on Ubuntu 18.04 lts. Today when Ubuntu got updated it installed php5.6 php7.0 php7.1 php7.3 beside my php7.2. I think I did something wrong but now I just don't want these versions on my server It's a server holding website and app so can't play with it, php -v now shows:
PHP Warning: PHP Startup: Unable to load dynamic library
'pdo_mysql.so' (tried: /usr/lib/php/20180731/pdo_mysql.so
(/usr/lib/php/20180731/pdo_mysql.so: undefined symbol:
pdo_parse_params), /usr/lib/php/20180731/pdo_mysql.so.so
(/usr/lib/php/20180731/pdo_mysql.so.so: cannot open shared object
file: No such file or directory)) in Unknown on line 0 PHP
7.3.2-3+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Feb 8 2019 15:43:57) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine
v3.3.2, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.2-3+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
But phpinfo file is normal not mentioning anything irregular and everything is functioning like normal, but I'd like to keep my server clean so any advice?
Try to find the pdo_mysql.so file manually using find
Edit your php.ini file so it points to the right location of this file.
Most likely php mysql library got overwritten as a result of installation of multiple versions of php. Also make sure you are editing the right php.ini file.
I can't configure ioncube or source guardian loaders with phpfarm. I thinks that is for "(DEBUG)" in php -v but I do not know how to. I need help with this issue.
My php -v:
root#martin:/opt/phpfarm/src# /opt/phpfarm/inst/php-5.3.22/bin/php -v
Cannot load the ionCube PHP Loader - it was built with configuration API220090626,NTS, whereas running engine is **API220090626,NTS,debug**
PHP Warning: PHP Startup: SourceGuardian: Unable to initialize module
Module compiled with build ID=API20090626,NTS
PHP compiled with build **ID=API20090626,NTS,debug**
These options need to match
in Unknown on line 0
Warning: PHP Startup: SourceGuardian: Unable to initialize module
Module compiled with build ID=API20090626,NTS
PHP compiled with build ID=API20090626,NTS,debug
These options need to match
in Unknown on line 0
PHP 5.3.22 (cli) (built: Apr 19 2015 17:43:14) **(DEBUG)**
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans
Although I can only answer for the ionCube Loaders, I presume the same applies to the Source Guardian Loaders.
PHP extensions need to match the exact same version, including release/debug status, thread-safety and PHP version. You are therefore right in that the ionCube Loaders will not work on PHP compiled with debug symbols. ionCube does not provide Loaders for this scenario, so your only solution is to build PHP as release version.
Do note that building PHP with debug symbols will most likely not help you debug your PHP scripts, if that is your goal.
I used Homebrew to install PHP versions 5.4 and 5.5 on my system. However, it seems that even after installing and linking to php55 my computer is still trying to run the version initially used by the system.
php --version
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20090626/php_openssl.dll' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20090626/php_openssl.dll, 9): image not found in Unknown on line 0
PHP 5.3.26 (cli) (built: Jul 7 2013 19:05:08)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
I believe Homebrew sets up PHP under '/usr/local/lib' and not '/usr/lib/'.
What do I need to do to correctly have my system use the Homebrew version of PHP?
You have to put /usr/local/bin at the front of your $PATH. In your ~/.bashrc file, add something like
export PATH="$(brew --prefix)/bin:${PATH}"
I've just upgraded from PHP 5.3.10 to 5.4, now I get the following when trying to initialise php on the command line in windows:
C:\php5.4>php -v
PHP Warning: PHP Startup: sqlsrv: Unable to initialize module
Module compiled with module API=20090626
PHP compiled with module API=20100525
These options need to match
in Unknown on line 0
PHP 5.4.0 (cli) (built: Feb 29 2012 19:06:50)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
This should be a straight swap. I've downloaded the NTS version of php (same as 5.3.10 version) & referenced the php_sqlsrv_53_nts_vc9.dll (v2) of sqlsrv.
Out of interest I also have the sqlsrv v3.0 extension, which I tried to load in and get the same error.
Has anyone else had this issue, or know of how to fix it?
TIA
D
It looks like the version of the dll you have is for PHP 5.3
I'm not sure if there is a version out for 5.4 yet, but you can check the PHP Extensions for Windows page to see.
The system requirements page from Microsoft appears to indicate not (although it may not have been updated yet).
Only you need this link: https://www.microsoft.com/en-us/download/details.aspx?id=20098 the version 3.0
Regards