Welcome to Centmin Mod Community
Register Now

PHP-FPM This code works in older centmin but not newer

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by Oxide, Oct 10, 2015.

  1. Oxide

    Oxide Active Member

    505
    29
    28
    Mar 19, 2015
    Ratings:
    +54
    Local Time:
    8:55 AM
    PHP:
    function RandomString($length) {
        
    $keys array_merge(range(0,9), range('a''z'));

        for(
    $i=0$i $length$i++) {
            
    $key .= $keys[array_rand($keys)];
        }
        return 
    $key;
    }


    Works in:
    Code:
    PHP 5.4.44 (cli) (built: Aug  9 2015 05:21:55)
    Copyright (c) 1997-2014 The PHP Group
    Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
    

    Does NOT Work in:
    Code:
    PHP 5.4.45 (cli) (built: Sep 15 2015 21:38:29)
    Copyright (c) 1997-2014 The PHP Group
    Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
        with Zend OPcache v7.0.5, Copyright (c) 1999-2015, by Zend Technologies
        with Suhosin v0.9.37.1, Copyright (c) 2007-2014, by SektionEins GmbH
    

    Any idea why?
    I am moving to the latest stable release, on another brand new dedicated server from a small VPS. When I use the following php-code on my newly installed centmin, it returns 500 internal server error.
     
  2. eva2000

    eva2000 Administrator Staff Member

    30,947
    6,915
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,413
    Local Time:
    8:55 AM
    Nginx 1.13.x
    MariaDB 5.5
    you installed suhosin which may have restricted some functions to php on later install while other doesn't have suhosin loaded
     
  3. Oxide

    Oxide Active Member

    505
    29
    28
    Mar 19, 2015
    Ratings:
    +54
    Local Time:
    8:55 AM
    yeah i though about that, are there a way to disable it tempoarily.. perhaps same way i disable zend? remove .ini
     
  4. Oxide

    Oxide Active Member

    505
    29
    28
    Mar 19, 2015
    Ratings:
    +54
    Local Time:
    8:55 AM
    i removed
    /etc/centminmod/php.d/suhosin.ini,

    it had no difference, still causes 500 error

    [​IMG]
     
  5. eva2000

    eva2000 Administrator Staff Member

    30,947
    6,915
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,413
    Local Time:
    8:55 AM
    Nginx 1.13.x
    MariaDB 5.5
    find suhosin.ini config file path with command
    Code:
    php --ini
    edit that suhonsin.ini and comment out the load extension line with semicolon ; and restart php-fpm

    you can also add suhosin custom settings into suhosin.ini or a separate custom php.in file as outlined at PHP-FPM - CentminMod.com LEMP Nginx web stack for CentOS
     
  6. eva2000

    eva2000 Administrator Staff Member

    30,947
    6,915
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,413
    Local Time:
    8:55 AM
    Nginx 1.13.x
    MariaDB 5.5
    restart php-fpm
     
  7. Oxide

    Oxide Active Member

    505
    29
    28
    Mar 19, 2015
    Ratings:
    +54
    Local Time:
    8:55 AM
    i did, also enabled error_logging but nothing appears in error.log
     
  8. eva2000

    eva2000 Administrator Staff Member

    30,947
    6,915
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,413
    Local Time:
    8:55 AM
    Nginx 1.13.x
    MariaDB 5.5
  9. Oxide

    Oxide Active Member

    505
    29
    28
    Mar 19, 2015
    Ratings:
    +54
    Local Time:
    8:55 AM
    checked "www-php.error.log" found:

    Code:
    [10-Oct-2015 14:08:02 UTC] PHP Fatal error:  Cannot redeclare RandomString() (previously declared in /home/nginx/domains/dd.dd.co/public/support.php:37) in /home/nginx/domains/dd.dd.co/public/inc/header.php on line 192
    
    fixed it now, guess its just more "nicer" than other ones lol
     
    • Informative Informative x 1