I'm running PHP 7.2 on Linux (Ubuntu 18.04) with SA 17.0.9.4935 and things are working fine. If I upgrade SA17 to version SA 17.0.10.5923, the PHP 7.2 extension module fails with a Bad Gateway 402 error. I've tried it with SA17 versions as far back as SA 17.0.10.5745 and they all fail with the 402 error. The Linux PHP extension module is SQLAnywhere-php-7.2_Linux.tar.gz with SHA-1: e1a6a9e133075bd9bea2d411a327cf5c2e6d61fb Is anyone running SA 17.0.10.xxxx successfully with PHP 7.2 on Linux? ############# UPDATE ############ I've now run this using the CLI, which should make it easier to reproduce. Here is an example: On SA 17.0.9.4935 and PHP 7.2.24-0ubuntu0.18.04.4 (cli), it runs properly with the expected output:
But on SA 17.0.10.5923, it crashes with the message:
It seems to be failing in the call to the PHP extension module which, as noted above, is is SQLAnywhere-php-7.2_Linux.tar.gz with SHA-1: e1a6a9e133075bd9bea2d411a327cf5c2e6d61fb Any ideas? |
As Volker noted, the file search algorithm was tamed in 17.0.10 to address security issues (spoofed DLLs/shared objects). It is key that the customary SQLA install structure be maintained (bin64, lib64, res, etc hanging off the install root), that SQLANY17 point to the install root, and for OS static loading that LD_LIBRARY_PATH include the path to lib64, and that PATH include any directories where dynamically loaded executable programs are to be found. A message like this one, Missing or invalid encryption DLL "libsapcrypto.so", suggests something is off in the SQLANY17 setting. I was beginning to suspect it was related to SQLANY17. I have LD_LIBRARY_PATH set correctly, but not SQLANY17. I've now added a definition for SQLANY17 to the php-cgi configuration and it seems to be working. i.e., the config file
Thanks. If you want to create an 'Answer', I can mark it correct.
(24 Apr '20, 15:39)
Terry Wilkinson
Replies hidden
That's great. I am sure that I don't have to remind you to make sure to unswap those shared objects from 17.0.9. :-)
(24 Apr '20, 16:15)
JBSchueler
Comment Text Removed
1
All the files in bin32/64 and lib32/64 have new dates that match the installation date, my application (PHP) is working fine, and I haven't had to make copies anywhere else, so I think all is well.
(25 Apr '20, 10:21)
Terry Wilkinson
|
I gave the Windows version a quick test and it seems to work. php -version PHP 7.2.30 (cli) (built: Apr 15 2020 09:15:11) ( ZTS MSVC15 (Visual C++ 2017) x64 ) I ran the query.php example. It uses the "demo" database. Can you run this? Is the "Bad Gateway 402" error occurring on a connect attempt? One major difference between .9 and .10 is the switch from OpenSSL to SAP Crypto.
The Windows version works. It's the Linux version that is failing. I'm calling it from a browser/nginx so the "Bad Gateway 402" error is coming because the PHP process fails. I have not tried it from CLI.
I've updated the OP to show an example of the problem using the Linux CLI.
Does this code get off the ground? That is, are you making the database connection in line 2. I assume that the PHP extension module you are using has not changed from 17.0.9 to 17.0.10. The extension uses libdbcapi.so which is dependent on libdblib17_r.so and, probably, libdbtasks17_r.so. So can you try swapping these out for the version 17.0.9 files and see if that cures things? It will help narrow down the problem.
I also noticed that a similar issue was posted a few years ago: https://sqlanywhere-forum.sap.com/questions/27444/php-warning-request_startup-for-sqlanywhere-module-failed-in-unknown-on-line-0
Anything there that might be useful?
There is also this post on Stackoverflow with a similar problem: https://stackoverflow.com/questions/41139964/sqlanywhere-php-extension-errors-on-apache-restart Perhaps?
Ok, I've added an initial print statement and there is no output, so I assume it does not "get off the ground".
I then replaced the 17.0.10 versions of libdblib17_r.so.1 and libdbtasks17_r.so.1 with the corresponding files from 17.0.9. It goes a bit farther but then it fails with
Warning: sasql_connect(): SQLAnywhere: [-832] Connection error: Missing or invalid encryption DLL "libsapcrypto.so" in /home/newsatlas/distros/php/test.php on line 3
However the file /opt/sqlanywhere17/lib64/libsapcrypto.so does exist.
I already have
Environment=LD_LIBRARY_PATH=/opt/sqlanywhere17/lib64
defined so I don't think this is the problem - also the same configuration is working for 17.0.9.Also related to
Environment=LD_LIBRARY_PATH=/opt/sqlanywhere17/lib64
setting - working for 17.0.9 but not for 17.0.10.Do you have a tool like strace or truss (I'm not sure of the name) that logs nitty-gritty stuff like shared object searches as the code is executing? It sounds like there is some sort of file search issue.
No, unfortunately I don't have (or know how to use) those tools.
Are you able reproduce the problem on your systems?
Also check for lib64/libslcryptokernel.so and lib64/libslcryptokernel.so.sha256. I believe that both of these files are required by libsapcrypto.so. Maybe not. I checked the doc and apparently these are only used for the "fips" module, libsapcryptofips.so.
I am working from home. Sorry, no Linux. I'll have to find someone with access to a Linux box.
On 17.0.10,
/opt/sqlanywhere17/lib64/libsapcrypto.so
is there, but neither of the others.On 17.0.9, none of them are there.
I don't use Linux so I have no clue at all - just want to mention that with 17.0.10.5745 the strategy to search for files such as shared libraries was changed, see the latest v17 readme, Engineering Case #819001. (No, I can't tell at all whether that may apply here.)
Was SA 17.0.10.4745 a typo? There should be no issue as long as $sqlany17 is set correctly.
I am also informed by the QA team that all php external environment tests have passed and continue to pass on Linux.
On Linux: Executable files are searched using $SQLANY17/bin64 and PATH. Shared objects are searched using $SQLANY17/lib64 and LD_LIBRARY_PATH. Resource files are searched using $SQLANY17/res. Jar files are searched using $SQLANY17/java.
Can't tell that, I'm not the OP...
Probably was a typo that should have been 17.0.10.5745 (I'll fix the OP)