Upgrade 1.1.21 to 1.2.0: nginx panel missing mcrypt

  • Hi there,


    it looks kind of strange to me. During upgrade to 1.2 first I had the autoinstall not recognize json. It was missing /etc/php5/mods-available/json.ini. My PHP is from dotdeb.org which has json compiled in. I fixed this by simply adding an empty json.ini.


    Now when going to http://serverip:8080/ I get this:

    Code
    1. An exception has been thrown in file /var/www/imscp/gui/library/shared-functions.php at line 3226:
    2. PHP extension 'mcrypt' not loaded!


    But mcrypt is loaded at least with 'php -m' and using a phpinfo() on the Apache website. I'm checking through the logs but by default everything seems disabled as all logs are empty. What information could be useful? Where should I check next?


    First of all, as I also saw past issues on Trac with PHP modules. Can't we use php -m to check for modules instead of scanning the ini's? The ini approach looks a bit error prone to me.



    Happy new year!

    • Please: i-MSCP bugs - Reporting rules
    • What was the error about missing json.ini file exactly?
    • What dotdeb repository you 're using exactly? What PHP version ( 5.4, 5.4 or 5.6)?
    • Output of:


    Shell-Script
    1. # /usr/bin/php5-cgi -m


    and

    Shell-Script
    1. # cat /var/www/fcgi/master/php5-fcgi-starter


    ???


    We cannot use php -m because it's only for PHP CLI.

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • Re;


    I've just tested a fresh install of the 1.2.0 version with dotdeb repository for PHP5.6:


    Shell-Script
    1. root@wheezy:/usr/local/src/imscp# cat /etc/apt/sources.listdeb http://http.us.debian.org/debian wheezy main contribdeb http://security.debian.org wheezy/updates main contribdeb http://http.us.debian.org/debian wheezy-updates main## backports - ONLY IF YOU KNOW WHAT YOU DO# deb http://http.us.debian.org/debian-backports/ wheezy-backports maindeb http://packages.dotdeb.org wheezy-php56 alldeb-src http://packages.dotdeb.org wheezy-php56 all


    Info about my test environment

    • Debian 7.7 base install ( Proxmox container ) + tasksel install standard + dpkg-reconfigure locales + dpkg-reconfigure tzdata
    • Dotdeb repository for PHP5.6 as shown above
    • i-MSCP 1.2.0 ( Fresh install )

    Distro info

    Shell-Script
    1. root@wheezy:/usr/local/src/imscp# lsb_release -aNo LSB modules are available.Distributor ID: DebianDescription: Debian GNU/Linux 7.7 (wheezy)Release: 7.7Codename: wheezy


    PHP version

    Shell-Script
    1. root@wheezy:/usr/local/src/imscp# php -vPHP 5.6.4-1~dotdeb.1 (cli) (built: Dec 19 2014 20:14:24) Copyright (c) 1997-2014 The PHP GroupZend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies


    PHP Modules ( For all SAPIs )

    Shell-Script
    1. root@wheezy:/usr/local/src/imscp# ls -la /etc/php5/*/conf.d/etc/php5/cgi/conf.d:total 8drwxr-xr-x 2 root root 4096 janv. 1 14:03 .drwxr-xr-x 3 root root 4096 janv. 1 14:03 ..lrwxrwxrwx 1 root root 32 janv. 1 14:02 05-opcache.ini -> ../../mods-available/opcache.inilrwxrwxrwx 1 root root 32 janv. 1 14:03 10-mysqlnd.ini -> ../../mods-available/mysqlnd.inilrwxrwxrwx 1 root root 28 janv. 1 14:02 10-pdo.ini -> ../../mods-available/pdo.inilrwxrwxrwx 1 root root 27 janv. 1 14:02 20-gd.ini -> ../../mods-available/gd.inilrwxrwxrwx 1 root root 29 janv. 1 14:02 20-imap.ini -> ../../mods-available/imap.inilrwxrwxrwx 1 root root 29 janv. 1 14:02 20-intl.ini -> ../../mods-available/intl.inilrwxrwxrwx 1 root root 31 janv. 1 14:02 20-mcrypt.ini -> ../../mods-available/mcrypt.inilrwxrwxrwx 1 root root 31 janv. 1 14:03 20-mysqli.ini -> ../../mods-available/mysqli.inilrwxrwxrwx 1 root root 30 janv. 1 14:03 20-mysql.ini -> ../../mods-available/mysql.inilrwxrwxrwx 1 root root 34 janv. 1 14:03 20-pdo_mysql.ini -> ../../mods-available/pdo_mysql.inilrwxrwxrwx 1 root root 33 janv. 1 14:02 20-readline.ini -> ../../mods-available/readline.ini/etc/php5/cli/conf.d:total 8drwxr-xr-x 2 root root 4096 janv. 1 14:03 .drwxr-xr-x 3 root root 4096 janv. 1 14:02 ..lrwxrwxrwx 1 root root 32 janv. 1 14:02 05-opcache.ini -> ../../mods-available/opcache.inilrwxrwxrwx 1 root root 32 janv. 1 14:03 10-mysqlnd.ini -> ../../mods-available/mysqlnd.inilrwxrwxrwx 1 root root 28 janv. 1 14:02 10-pdo.ini -> ../../mods-available/pdo.inilrwxrwxrwx 1 root root 27 janv. 1 14:02 20-gd.ini -> ../../mods-available/gd.inilrwxrwxrwx 1 root root 29 janv. 1 14:02 20-imap.ini -> ../../mods-available/imap.inilrwxrwxrwx 1 root root 29 janv. 1 14:02 20-intl.ini -> ../../mods-available/intl.inilrwxrwxrwx 1 root root 31 janv. 1 14:02 20-mcrypt.ini -> ../../mods-available/mcrypt.inilrwxrwxrwx 1 root root 31 janv. 1 14:03 20-mysqli.ini -> ../../mods-available/mysqli.inilrwxrwxrwx 1 root root 30 janv. 1 14:03 20-mysql.ini -> ../../mods-available/mysql.inilrwxrwxrwx 1 root root 34 janv. 1 14:03 20-pdo_mysql.ini -> ../../mods-available/pdo_mysql.inilrwxrwxrwx 1 root root 33 janv. 1 14:02 20-readline.ini -> ../../mods-available/readline.ini/etc/php5/fpm/conf.d:total 8drwxr-xr-x 2 root root 4096 janv. 1 14:03 .drwxr-xr-x 4 root root 4096 janv. 1 14:02 ..lrwxrwxrwx 1 root root 32 janv. 1 14:02 05-opcache.ini -> ../../mods-available/opcache.inilrwxrwxrwx 1 root root 32 janv. 1 14:03 10-mysqlnd.ini -> ../../mods-available/mysqlnd.inilrwxrwxrwx 1 root root 28 janv. 1 14:02 10-pdo.ini -> ../../mods-available/pdo.inilrwxrwxrwx 1 root root 27 janv. 1 14:02 20-gd.ini -> ../../mods-available/gd.inilrwxrwxrwx 1 root root 29 janv. 1 14:02 20-imap.ini -> ../../mods-available/imap.inilrwxrwxrwx 1 root root 29 janv. 1 14:02 20-intl.ini -> ../../mods-available/intl.inilrwxrwxrwx 1 root root 31 janv. 1 14:02 20-mcrypt.ini -> ../../mods-available/mcrypt.inilrwxrwxrwx 1 root root 31 janv. 1 14:03 20-mysqli.ini -> ../../mods-available/mysqli.inilrwxrwxrwx 1 root root 30 janv. 1 14:03 20-mysql.ini -> ../../mods-available/mysql.inilrwxrwxrwx 1 root root 34 janv. 1 14:03 20-pdo_mysql.ini -> ../../mods-available/pdo_mysql.inilrwxrwxrwx 1 root root 33 janv. 1 14:02 20-readline.ini -> ../../mods-available/readline.ini


    i-MSCP server implementation in use

    Shell-Script
    1. root@wheezy:/usr/local/src/imscp# cat /etc/imscp/imscp.conf |grep '_SERVER ='
    2. FRONTEND_SERVER = nginx
    3. SQL_SERVER = mysql_5.5
    4. PO_SERVER = dovecot
    5. NAMED_SERVER = bind
    6. HTTPD_SERVER = apache_php_fpm
    7. FTPD_SERVER = proftpd
    8. MTA_SERVER = postfix


    Result


    All worked as expected without any error, nor warning.


    Files

    • result.png

      (27.78 kB, downloaded 71 times, last: )
    • result2.png

      (106.47 kB, downloaded 74 times, last: )
    • result3.png

      (165.44 kB, downloaded 68 times, last: )

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • Hi Nuxwin,


    sorry for the missing bits... I don't know if my hacked up testing machine can be seen as reference. Thus I was more overly interested in the process of checking for modules by searching for ini files. It seems not the perfect approach ;)...


    installer stopped because it was missing the json.ini in /etc/php5/mods-available. But the file couldn't be there when json is compiled in the main application. So I just created an empty file, ok for the installer. And on we go...


    The interesting information was that nginx is using php5-cgi. I have Apache using FPM, so nginx just could use another pool. That was what I thought. /etc/php/cgi didn't exist, so mcrypt was not active for cgi. Reinstalling php5-cgi solved the problem. So it seems that while we have validation for the used modules by checking mods-available, we do not validate if those mods are loaded at all.


    So perhaps some room for improvements here... :P

  • 1. Version 1.2.0 do not search for any module ini file. Only modules which are available as per ini file are loaded using php5enmod command if available. So you're wrong in your sentence here. I you can see in the ls result above, no json.ini file is here and all is fine ;)
    2. I've do a fresh install of the 1.2.0 using dotdeb repo on Debian Wheezy ( see above ) and I've not see any problem with json.ini file.


    To resume here, something was wrong with your setup, not with i-MSCP ;)


    Also

    Nginx + spawn-fcgi + php-cgi = i-MSCP frontEnd (panel)
    Apache2 + FastCGI (or proxy fcgi) + php-fpm = Your customer's sites


    Finally, before saying that something is wrong, you should really consider to learn how i-MSCP is working. I'm maybe a bit rude here but I'm tired to read your reports which are based on assumptions only. I hate loosing time ;)

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • I'm learning all the time and always willing to continue my learning. Please let's stay polite... I wasn't stating that something IS wrong. I was asking if something COULD be wrong and I am wondering if there is room for improvement. No software is perfect and no developer is perfect neither, but that's not the problem... don't be offended by my comments. We are both pro's here.


    autoinstaller/Adapter/DebianAdapter.pm has php5enmod ...json... (line 290)

    Code
    1. # Make sure that PHP modules are enabledif(-x '/usr/sbin/php5enmod') {my($stdout, $stderr);my $rs = execute('php5enmod gd imap intl json mcrypt mysql mysqli mysqlnd pdo pdo_mysql', \$stdout, \$stderr);debug($stdout) if $stdout;error($stderr) if $stderr && $rs;return $rs if $rs;}


    If I remove /etc/php5/mods-available/json.ini (which is not included in the dotdeb 5.4 package) php5enmod says:

    Code
    1. ERROR: /etc/php5/mods-available/json.ini does not exist


    And thus autoinstaller will fail. But according to php5 -m, php5-cgi -m and php5-whatever -m json is there because it is compiled in. Thus it (in my honest personal opinion) is not 100% perfect to use php5enmod for things that could be compiled in. :) That's all I'm talking about.


    I hope this was clear enough :)


    OTOH: if PHP 5.6 is requirement for running iMSCP 1.2 then please point me where I have missed this information. You may retry your test with PHP 5.4, but I wouldn't insist on this to happen.

  • I'm learning all the time and always willing to continue my learning. Please let's stay polite...


    Sorry but I'm polite. Maybe a bit rude, but polite ;)


    Normally, you get only a warning for inexistent modules. If php5enmod command has different behavior, depending on the PHP version in use, it's another story...


    Code
    1. root@wheezy:/etc/apache2# php5enmod json
    2. WARNING: Module json ini file doesn't exist under /etc/php5/mods-available
    3. WARNING: Module json ini file doesn't exist under /etc/php5/mods-available
    4. WARNING: Module json ini file doesn't exist under /etc/php5/mods-available
    5. root@wheezy:/etc/apache2# echo $?
    6. 0
    7. root@wheezy:/etc/apache2

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • Re;;


    php5enmod (PHP5.4)

    Code
    1. root@wheezy:/etc/apache2# php5enmod json
    2. ERROR: /etc/php5/mods-available/json.ini does not exist
    3. root@wheezy:/etc/apache2# echo $?
    4. 2
    5. root@wheezy:/etc/apache2#


    To resume, I need only add a check to thrown an error if exit code is not 0 nor 2. I like consistency in scripts between PHP versions...


    Of course, I could use the binaries directly but the problem there is that i-MSCP uses different SAPIs (cli, cgi, fpm, apache2). Thus, while I can easily manage when using the cli, fpm or cgi SAPis, This is an another story for the apache2 SAPI. Also, the php5enmod command can operate for all SAPIs in same time while with binaries, I must create a loop and parse the result too.

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • Re;


    I'll solve the problem with:


    Perl
    1. # Make sure that PHP modules are enabled
    2. if(-x '/usr/sbin/php5enmod') {
    3. my($stdout, $stderr);
    4. my $rs = execute('php5enmod gd imap intl json mcrypt mysql mysqli mysqlnd pdo pdo_mysql', \$stdout, \$stderr);
    5. debug($stdout) if $stdout;
    6. unless($rs ~~ [0, 2]) {
    7. error($stderr) if $stderr;
    8. return $rs;
    9. }
    10. }

    badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206

  • badge.php?id=1239063037&bid=2518&key=1747635596&format=png&z=547451206