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!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

SOLVED Fatal error: Call to undefined function mysql_connect()

Discussion in 'General Discussion' started by Ovivo, Aug 8, 2017.

  1. Ovivo

    Ovivo Member

    Joined:
    Jun 16, 2016
    Messages:
    12
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Chile
    cPanel Access Level:
    Root Administrator
    Hello

    I have a problem with a site on my server.
    The following error code sends me the error Fatal error: Calling the undefined function mysql_connect ()

    <?php
    $enlace = mysql_connect('localhost', 'user_mysql', 'pass_mysql');
    if (!$enlace) {
    die('No pudo conectarse: ' . mysql_error());
    }
    echo 'Conectado satisfactoriamente';
    mysql_close($enlace);
    ?>

    On the server I have Apache 4 and the site where this is running has PHP 5.4 also enabled php54-php-mysqlnd extension

    He also tested with the mysqli_connect statement with the same result

    Here is the link to the phpinfo site [Removed]
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    15,769
    Likes Received:
    313
    Trophy Points:
    433
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    This is more of scripting issue than an issue with your cPanel. You might do better to ask this on a forum dedicated to that sort of thing, or speak with the author of your script.
     
  3. Ovivo

    Ovivo Member

    Joined:
    Jun 16, 2016
    Messages:
    12
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Chile
    cPanel Access Level:
    Root Administrator
    Dear

    The problem is that I have Apache 4 installed, with the correct extension for php 5.4, but the code I indicated does not work. And that same code on a server with apache 3 and php 5.6 if it works
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,427
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Could you verify the contents of the .htaccess file in the account's home directory, or it's public_html directory? Also, are you using a custom php.ini file with this account?

    Thank you.
     
  5. Ovivo

    Ovivo Member

    Joined:
    Jun 16, 2016
    Messages:
    12
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Chile
    cPanel Access Level:
    Root Administrator
    The contents of the .htacces file is

    suPHP_ConfigPath /home/fya/public_html

    <Files php.ini>
    order allow,deny
    deny from all
    </Files>

    And custom php.ini

    date.timezone = "America/Santiago"

    allow_url_fopen = Off
    extension=simplexml.so
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,427
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Can you remove this entry from the .htaccess file, move the custom php.ini file out of the way, and then make any custom php.ini changes using the MultiPHP INI Editor in cPanel? Keep in mind "allow_url_fopen" is a global PHP value so you'd need to enable it from the MultiPHP INI Editor in WHM to allow it's use.

    Thank you.
     
  7. Ovivo

    Ovivo Member

    Joined:
    Jun 16, 2016
    Messages:
    12
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Chile
    cPanel Access Level:
    Root Administrator
    Thank you very much, perfect work
     
    cPanelMichael likes this.
Loading...

Share This Page