SOLVED Fatal error: Call to undefined function mysql_connect()

Ovivo

Member
Jun 16, 2016
24
2
3
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]
 

Ovivo

Member
Jun 16, 2016
24
2
3
Chile
cPanel Access Level
Root Administrator
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.
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
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
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.
 

Ovivo

Member
Jun 16, 2016
24
2
3
Chile
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.
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
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
suPHP_ConfigPath /home/fya/public_html
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.