Get the most out of your Centmin Mod LEMP stack
Become a Member

PHP-FPM Strange PHP-FPM problem after PHP rebuild

Discussion in 'Install & Upgrades or Pre-Install Questions' started by wmtech, Aug 24, 2024.

  1. wmtech

    wmtech Active Member

    174
    44
    28
    Jul 22, 2017
    Ratings:
    +129
    Local Time:
    2:55 PM
    We have a website with an old XenForo 1 installation with Centminmod 130.00beta01 at a dedicated Rocky 8.10 server (only Centminmod with Nginx 1.25.4 and PHP-FPMD 7.2.34 running beside Redis and Memcached). That setup runs smoothly without problems since years with occasional updates for Nginx and recompile of PHP 7.2.34 using Centminmod.

    Last week we decided to upgrade the server to Centminmod 140.00beta01 which could be done without any problems. We also upgraded Nginx to 1.27.1, also without any problems.

    But after we recompiled PHP 7.2.34 (the same version we used since many years) to catch any new patches (we did that without any problems several times before), the server began to make weird things. It started to raise CPU usage exponentially until the server breaks down. After a restart of the server we recognised that some (not all) XenForo thread and gallery pages could not finish to be shown at the visitors browser and timed out at PHP-FPM with one of the the following 2 errors:

    Code (Text):
    Maximum execution time of 60 seconds exceeded in /library/XenForo/Template/Abstract.php on line 366
    


    Code (Text):
    Maximum execution time of 60 seconds exceeded in /library/XenForo/Helper/String.php on line 519
    


    Some thread and gallery pages show without delay and some of them end with that error. The server builds up load until the CPU gets overwhelmed and the server crashes.

    We tried to find the bug without any success. We tried to upgrade PHP 7.2.34 to PHP 7.3.33 but the problem persists with exactly the same behaviour.

    Only a downgrade to PHP 7.1.33 solved the problem and Xenforo runs without problems again.

    We could not find the exact reason for our problems. It seems that the recompile of PHP 7.2.34 under Centminmod 140.00beta01 introduced some kind of incompatibility with XenForo 1. Perhaps an updated module or a newly introduced patch? Because the upgrade to PHP 7.3.33 did not solve the issue whereas the downgrade to PHP 7.1.33 does the incompatible module or patch seems to be applied to PHP 7.2 upwards only.

    Does anyone has any clue or a tip what the problem could have been?
    @eva2000 perhaps?

    Thanks for any help.

    The relevant custom config vars for our installation, all the installed PHP modules are Centminmod standard:

    Code (Text):
    PHP_PGO='y'
    MARCH_TARGETNATIVE='n'
    PHPFINFO='y'
    


     
    Last edited: Aug 24, 2024
  2. eva2000

    eva2000 Administrator Staff Member

    54,113
    12,179
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,739
    Local Time:
    11:55 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
  3. wmtech

    wmtech Active Member

    174
    44
    28
    Jul 22, 2017
    Ratings:
    +129
    Local Time:
    2:55 PM
    Thank you. I'll try that within the next maintenance window and report if successful.
     
  4. MaximilianKohler

    MaximilianKohler Member

    196
    5
    18
    Jun 23, 2023
    Ratings:
    +28
    Local Time:
    5:55 AM
    Continuing here from this related thread.

    Looking at my /root/centminlogs folder, I only see one other upgrade log from an earlier date (07/05/2024), but it's from 8.2.21 to the same version.

    I set
    Code:
    DEVTOOLSETTWELVE='y'
    DEVTOOLSETTHIRTEEN='n'
    in /etc/centminmod/custom_config.inc. Then ran the php upgrade again and it worked. Thanks!
     
  5. eva2000

    eva2000 Administrator Staff Member

    54,113
    12,179
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,739
    Local Time:
    11:55 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Great 140.00beta01 is getting another update for fallback GCC 12 when PHP_PGO='y' set for now
     
  6. wmtech

    wmtech Active Member

    174
    44
    28
    Jul 22, 2017
    Ratings:
    +129
    Local Time:
    2:55 PM
    Coming back to this thread after a while with no work at that server.

    I now tried to recompile PHP 7.2.34 at that server (centminmod beta 140.0 current), using "PHP_PGO='n' as recommended by you. It failed to compile.

    I also tried with "DEVTOOLSETTWELVE='y' && DEVTOOLSETTHIRTEEN='n'" with no luck and resulting in the same error.

    Here is a part of the error log:

    Code (Text):
    Using GCC 8
    
    export CFLAGS="-O3 -m64 -march=x86-64-v3 -pipe -Wno-deprecated-declarations -fstack-protector-strong -fPIC"
    export CPPFLAGS=" -D_FORTIFY_SOURCE=2"
    export ICU_CFLAGS='-fPIC'
    export LIBSODIUM_CFLAGS='-fPIC'
    export LIBZIP_CFLAGS="-I/opt/remi/libzip/include -fPIC"
    export PHP_LDFLAGS=" -Wl,-z,relro,-z,now -pie -Wl,-rpath,/opt/remi/libzip/lib64"
    2
    LD_LIBRARY_PATH=/opt/remi/libzip/lib64:/usr/local/lib64 PKG_CONFIG_PATH="/opt/remi/libzip/lib64/pkgconfig:/usr/local/lib64/pkgconfig:" ../configure --enable-fpm --enable-opcache --enable-intl --enable-pcntl --with-mcrypt --with-snmp --enable-embed=shared --with-mhash --with-zlib --with-gettext --enable-exif --enable-zip --with-bz2 --enable-soap --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-shmop --with-pear --enable-mbstring --with-openssl --with-mysql=mysqlnd --with-libdir=lib64 --with-mysqli=mysqlnd --with-mysql-sock=/var/lib/mysql/mysql.sock --with-curl --with-gd --with-xmlrpc --enable-bcmath --enable-calendar  --enable-ftp --enable-gd-native-ttf --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr --with-webp-dir=/usr --with-t1lib=/usr --enable-shmop --with-pear --enable-mbstring --with-openssl --with-mysql=mysqlnd --with-libdir=lib64 --with-mysqli=mysqlnd --enable-pdo --with-pdo-sqlite --with-pdo-mysql=mysqlnd --enable-inline-optimization --with-imap --with-imap-ssl --with-kerberos --with-readline --with-libedit --with-gmp --with-pspell --with-tidy --with-enchant --with-fpm-user=nginx --with-fpm-group=nginx --with-ldap --with-ldap-sasl --with-pic --with-config-file-scan-dir=/etc/centminmod/php.d --with-fpm-systemd --with-xsl
    configure: WARNING: unrecognized options: --with-mcrypt, --with-mysql, --enable-gd-native-ttf, --with-t1lib, --with-mysql
    checking for grep that handles long lines and -e... /bin/grep
    checking for egrep... /bin/grep -E
    checking for a sed that does not truncate output... /bin/sed
    checking build system type... x86_64-unknown-linux-gnu
    checking host system type... x86_64-unknown-linux-gnu
    checking target system type... x86_64-unknown-linux-gnu
    ../build/shtool: line 509: warning: command substitution: ignored null byte in input
    ../build/shtool: line 510: warning: command substitution: ignored null byte in input
    ../build/shtool: line 509: warning: command substitution: ignored null byte in input
    ../build/shtool: line 510: warning: command substitution: ignored null byte in input
    checking whether the C compiler works... no
    configure: error: in `/svr-setup/php-7.2.34/fpm-build':
    configure: error: C compiler cannot create executables
    See `config.log' for more details
    sed: can't read Makefile: No such file or directory
    sed: can't read Makefile: No such file or directory
    
    Sun Nov 10 10:20:36 UTC 2024
    Error: , PHP configure failed (140.00beta01.b158)
     
  7. eva2000

    eva2000 Administrator Staff Member

    54,113
    12,179
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,739
    Local Time:
    11:55 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    has it at all worked since you last posted at https://community.centminmod.com/th...-problem-after-php-rebuild.26164/#post-101123 ? or this first attempt since then?

    noticed in your output
    Code (Text):
    Using GCC 8
    

    seems it isn't using right GCC version now

    double check your persistent config file at /etc/centminmod/custom_config.inc to ensure you haven't duplicated some variables where latter referenced variable value overrides prior reference as well.
     
  8. wmtech

    wmtech Active Member

    174
    44
    28
    Jul 22, 2017
    Ratings:
    +129
    Local Time:
    2:55 PM
    This was the first attempt since then. Nothing done at the server since then except OS and centminmod updates.

    Noticed that as well. Right before trying to update PHP I updated Nginx to 1.27.2 successfully.

    Nothing in custom_config except the settings mentioned. At first try "PHP_PGO" was off and at second try "DEVTOOLSETTWELVE" was on and "DEVTOOLSETTHIRTEEN" was off.

    GCC 8 seems to be the default compiler at Alma 8.
     
  9. eva2000

    eva2000 Administrator Staff Member

    54,113
    12,179
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,739
    Local Time:
    11:55 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
  10. wmtech

    wmtech Active Member

    174
    44
    28
    Jul 22, 2017
    Ratings:
    +129
    Local Time:
    2:55 PM
    Sent via PN.
     
  11. wmtech

    wmtech Active Member

    174
    44
    28
    Jul 22, 2017
    Ratings:
    +129
    Local Time:
    2:55 PM
    Coming back to my very strange problem from the first post in this thread.

    I setup a copy of the production server with that problem as a test server and started a research mission on why it was not possible to install a fully functional PHP 7.2 at Rocky 8 with Centminmod.

    Using the most recent Centminmod version PHP 7.2 compiled without problems after forcing GCC 12, but the problems from the first post (high CPU load, timeouts at some pages) occurred again.

    I found out that the whole problem was caused by the PHP opcache module. If opcache was disabled everything worked without problems. With opcache enabled the problems started again. But opcache is a must, so I had to solve this mystery.

    Compiling PHP 7.2 with GCC 13 showed exactly the same errors.

    However compiling PHP 7.2 with GCC 11 works well and opcache does what is expected without high CPU loads and timeouts.

    So, if anyone uses Rocky 8 and needs to run the old PHP 7 with it (e.g. when still using XF 1.5), use

    Code (Text):
    DEVTOOLSETELEVEN='y'

    in your custom_config to avoid any problems.
    I don't know and didn't find any information about why PHP opcache does not compile correctly with GCC > 11.

    But for now the problem has been solved.
     
  12. eva2000

    eva2000 Administrator Staff Member

    54,113
    12,179
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,739
    Local Time:
    11:55 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Interesting, were all servers using same CPU models? GCC newer versions add new CPU models support and can play differently with older CPUs - especially very old CPUs. Probably more work, but have you tried reproducing the issue with AlmaLinux 8 ? The way AlmaLinux and Rocky Linux build now has diverged so could be related. Did you change any Zend Opcache settings?
     
  13. wmtech

    wmtech Active Member

    174
    44
    28
    Jul 22, 2017
    Ratings:
    +129
    Local Time:
    2:55 PM
    I tested with different CPU too. The production server, were that problem occurred first, runs with AMD EPYC. The test server, which showed the same problem, runs with Intel Xeon Scalable CPUs. So I doubt the CPU makes a difference.

    I also tested different settings with Zend Opcache. Any setting I tried did not help. So I stayed with your default CMM settings.

    I did not try it with Alma 8, because we run Rocky 8/9 at all our servers and do not use Alma 8. But yes, there may be a difference between Alma and Rocky, as I know you prefer Alma and may use that when working at Centminmod.
     
  14. eva2000

    eva2000 Administrator Staff Member

    54,113
    12,179
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,739
    Local Time:
    11:55 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Thanks for that info. While I do alot of automated testing for Centmin Mod across AlmaLinux, Rocky Linux, Oracle Linux, most manual testing is done on AlmaLinux right now so probably a gap there. So might need to do some manual tests with Rocky Linux too. IIRC EL 9.5 OSes will also offer up GCC 14 so could widen the testing. I've also created my own custom GCC 15 RPMs for early testing in Centmin Mod 140.00beta01 to get ahead of issues but again that is more AlmaLinux manual tests right now.