LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware - ARM (https://www.linuxquestions.org/questions/slackware-arm-108/)
-   -   php 8.1 segmentation fault (https://www.linuxquestions.org/questions/slackware-arm-108/php-8-1-segmentation-fault-4175705512/)

sya54M 12-28-2021 10:37 AM

php 8.1 segmentation fault
 
Hi everyone, I installed the new php 8.1 from Slackware arm extra packages, but it seems buggy to me, it crashes on mysqli_query() when connected to local database.
Pat reintroduced the 8.0 on x86, but only 8.1 is left on arm.
Can anyone help me?

Exaga 12-28-2021 02:12 PM

Quote:

Originally Posted by sya54M (Post 6312954)
Hi everyone, I installed the new php 8.1 from Slackware arm extra packages, but it seems buggy to me, it crashes on mysqli_query() when connected to local database.
Pat reintroduced the 8.0 on x86, but only 8.1 is left on arm.
Can anyone help me?

Is this any help to you? https://github.com/r00t4bl3/php8-SlackBuild

sya54M 12-29-2021 02:57 AM

ok I compiled it, I would have liked an official package :-D

Exaga 12-29-2021 05:20 AM

Quote:

Originally Posted by sya54M (Post 6313090)
ok I compiled it, I would have liked an official package :-D

Those with no other options must be content with what is offered. Merry Christmas.

sya54M 12-29-2021 05:47 AM

thanks, merry Christmas to you too

sya54M 12-29-2021 06:19 AM

here is the crash:

Code:

php-cgi: malloc.c:2539: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.

drmozes 12-30-2021 09:32 AM

Quote:

Originally Posted by sya54M (Post 6313119)
here is the crash:

Code:

php-cgi: malloc.c:2539: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.

Do you have some code to reproduce this? you're using the cgi so hopefully it's reasonably straight forward and doesn't require the set up of an httpd.

Does php 8.0 work when you compiled it? I hadn't got around to adding php 8.0 to /extra yet but I'll put it in the queue.

sya54M 12-30-2021 09:41 AM

Code:

$mysqli = new mysqli("localhost", "my_user", "my_password", "my_db"); //very important that the host is set to localhost
$result = $mysqli->query("SELECT * FROM my_table");

Doesn't require the set up of an httpd.

With the 8.0 version work fine.

I have reported the problem also in the php site:
https://bugs.php.net/bug.php?id=81696

drmozes 12-30-2021 12:25 PM

Quote:

Originally Posted by sya54M (Post 6313387)
Code:

$mysqli = new mysqli("localhost", "my_user", "my_password", "my_db"); //very important that the host is set to localhost
$result = $mysqli->query("SELECT * FROM my_table");

Doesn't require the set up of an httpd.


Code:

mozes@mojo:~/ac/source/n/php/tests# ./php81-fail.php
PHP Warning:  PHP Startup: Unable to load dynamic library 'xmlrpc' (tried: /usr/lib/php/extensions/xmlrpc (/usr/lib/php/extensions/xmlrpc: cannot open shared object file: No such file or directory), /usr/lib/php/extensions/xmlrpc.so (/usr/lib/php/extensions/xmlrpc.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Fatal error:  Uncaught mysqli_sql_exception: No such file or directory in /mnt/armedslack/slackwarearm-current/source/n/php/tests/php81-fail.php:3
Stack trace:
#0 /mnt/armedslack/slackwarearm-current/source/n/php/tests/php81-fail.php(3): mysqli->__construct()
#1 {main}
  thrown in /mnt/armedslack/slackwarearm-current/source/n/php/tests/php81-fail.php on line 3

Confirmed! It works with the php 7 though, and I imagine it'll also work with 8.0 since it does for you.

Quote:

I have reported the problem also in the php site:
https://bugs.php.net/bug.php?id=81696
Thanks. I have to say, this is one of the best bug reports I've ever had! I think you've solved it yourself :-)

drmozes 12-30-2021 12:32 PM

I tested on AArch64 as well, and it fails with php 8.0 and 8.1
Code:

mozes@bladswede:~/ac/source/n/php/tests# ./php81-fail.php
PHP Warning:  PHP Startup: xmlrpc: Unable to initialize module
Module compiled with module API=20190902
PHP    compiled with module API=20210902
These options need to match
 in Unknown on line 0
PHP Fatal error:  Uncaught mysqli_sql_exception: No such file or directory in /mnt/armedslack/slackwarearm-current/source/n/php/tests/php81-fail.php:3
Stack trace:
#0 /mnt/armedslack/slackwarearm-current/source/n/php/tests/php81-fail.php(3): mysqli->__construct()
#1 {main}
  thrown in /mnt/armedslack/slackwarearm-current/source/n/php/tests/php81-fail.php on line 3

php 8.0:

Code:

mozes@bladswede:~/ac/source/n/php/tests# ./php81-fail.php
PHP Warning:  PHP Startup: xmlrpc: Unable to initialize module
Module compiled with module API=20190902
PHP    compiled with module API=20200930
These options need to match
 in Unknown on line 0
PHP Warning:  mysqli::__construct(): (HY000/2002): No such file or directory in /mnt/armedslack/slackwarearm-current/source/n/php/tests/php81-fail.php on line 3
PHP Fatal error:  Uncaught Error: mysqli object is already closed in /mnt/armedslack/slackwarearm-current/source/n/php/tests/php81-fail.php:4
Stack trace:
#0 /mnt/armedslack/slackwarearm-current/source/n/php/tests/php81-fail.php(4): mysqli->query()
#1 {main}
  thrown in /mnt/armedslack/slackwarearm-current/source/n/php/tests/php81-fail.php on line 4

I see in the report that you built it with debugging enabled. The PHP SlackBuild you were directed to previously isn't the official Slackware build script, so I don't know if it has different build options which happen to fix this. The official build script is here.
http://ftp.slackware.com/pub/slackwa...t/extra/php80/

PHP 8.0 is building on 32bit ARM now so I'll have a look at that in the next few days.

Exaga 12-30-2021 10:46 PM

Quote:

Originally Posted by drmozes (Post 6313421)
The PHP SlackBuild you were directed to previously isn't the official Slackware build script, so I don't know if it has different build options which happen to fix this. The official build script is here.
http://ftp.slackware.com/pub/slackwa...t/extra/php80/

That's the php8 package. For the official php80.SlackBuild script he'll want this URL: http://ftp.slackware.com/pub/slackwa.../source/php80/ ?

The official script includes '--enable-maintainer-zts --with-xmlrpc=shared --with-expat' build options where the GitHub script doesn't.


All times are GMT -5. The time now is 10:45 PM.