Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

SOLVED Call to undefined function eregi

Discussion in 'EasyApache' started by canou83, Mar 18, 2018.

  1. canou83

    canou83 Well-Known Member

    Joined:
    Jul 20, 2016
    Messages:
    77
    Likes Received:
    7
    Trophy Points:
    8
    Location:
    France
    cPanel Access Level:
    Website Owner
    Hello, I have a site that runs and must launch a CRON task all X periods.
    This task imports orders into a commercial administration software.

    This one is in PHP 5.6 php-fpm on easyapache4

    The import of the commands in manual works, but in automatic, task CRON I have this error:

    Fatal error: Uncaught Error: Call to undefined function eregi() in /home/xxxxx/public_html/scripts/ecommerce/ws_import.php:32
    Stack trace:
    #0 {main}
    thrown in /home/xxxxx/public_html/scripts/ecommerce/ws_import.php on line 32
    Import end dim. mars 18 10:50:02 CET 2018

    Line 32 of this file is:

    Code:
    if (eregi ('([^ \\\ /] +) $', $ script_file, $ reg)) $ script_file = $ reg [1];
    Thanks for your help
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. rpvw

    rpvw Well-Known Member

    Joined:
    Jul 18, 2013
    Messages:
    819
    Likes Received:
    299
    Trophy Points:
    113
    Location:
    Spain
    cPanel Access Level:
    Root Administrator
    The ereg(i) function was DEPRECATED in PHP 5.3.0, and REMOVED in PHP 7.0.0.

    You probably should upgrade or rewrite the script to one that uses preg_match instead of eregi

    An alternative is to ask your webhost to install a PHP 5.2 version if it is not already available to you, and switch to that.

    If your orders > import > administration software principally run on a PHP version higher than 5.2, you will be better using the highest recommended PHP version for the orders and admin software, and re-writing the importation routines to be compatible.

    This is not really a cPanel issue, and you will probably get better help from forums like eg Stack Overflow
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    #2 rpvw, Mar 18, 2018
    Last edited: Mar 18, 2018
    cPanelMichael likes this.
  3. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,761
    Likes Received:
    116
    Trophy Points:
    343
    cPanel Access Level:
    Root Administrator
    Is this a piece of software that you wrote or that you obtained from some where else (free, commercially licensed, etc)?

    If it's something you obtained from some where else, then the script is outdated or abandoned. You need to update the script to the latest version since this version of the script is obviously not written for modern PHP versions and likely has many other security holes that malicious users may be able to abuse. If you are using the latest version, then the script is likely abandoned by it's developer because eregi() has been deprecated for some time. Any developer worth their weight would have resolved this years ago.
     
    cPanelMichael likes this.
  4. canou83

    canou83 Well-Known Member

    Joined:
    Jul 20, 2016
    Messages:
    77
    Likes Received:
    7
    Trophy Points:
    8
    Location:
    France
    cPanel Access Level:
    Website Owner
    Thanks to you 2 for this information.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. kdean

    kdean Well-Known Member

    Joined:
    Oct 19, 2012
    Messages:
    285
    Likes Received:
    20
    Trophy Points:
    18
    Location:
    Orlando, FL
    cPanel Access Level:
    Root Administrator
    Barring updating the code, it's likely that your command line php is just running a later version than the site.

    If your cron starts with php or /usr/bin/php or similar you can try changing it to:

    /opt/cpanel/ea-php56/root/usr/bin/php

    to specifically use the same version as your site.
     
    rpvw likes this.
  6. rpvw

    rpvw Well-Known Member

    Joined:
    Jul 18, 2013
    Messages:
    819
    Likes Received:
    299
    Trophy Points:
    113
    Location:
    Spain
    cPanel Access Level:
    Root Administrator
    I'm going to hazard a guess the file in question is the one detailed at FHenry/speedealing and which would seem to have been first committed to github circa 2011

    Perhaps the author can provide you with an up-to-date version - or help you bring your version up-to-date.

    The previous suggestion from kdean does rather have some value although I wonder if you shouldn't be calling the PHP 5.2 bianry for the cron job (assuming it is available) if you don't want to get continual error messages.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    #6 rpvw, Mar 18, 2018
    Last edited: Mar 18, 2018
  7. canou83

    canou83 Well-Known Member

    Joined:
    Jul 20, 2016
    Messages:
    77
    Likes Received:
    7
    Trophy Points:
    8
    Location:
    France
    cPanel Access Level:
    Website Owner
    Thanks
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,802
    Likes Received:
    1,896
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    I've marked this thread as solved.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice