call to undefinied function mysql_connect()

I got the following page when testing a php page for creating subscribers inside database.

The error message is as below"

[Mon Apr 27 15:30:53 2015] [client] PHP Fatal error:  Call to undefined function mysql_connect() in /var/www/bbemod/includes/class.database.php on line 51, referer: "

The PHP page signup.php is as following:

<?php include "header.php"; ?>

<div class="umTop">Signup for newsletter</div>
    <div class="umcont">
    if (isset($_GET['addr'])) {
        $email = $_GET['addr'];
        if (validate_email_addr($email)) {
        	$sub = new Subscriber();
        	if (! Subscriber::find($email, $sub)) {
            	$sub->email_addr = $email;
        	echo "<p>Thank you. " . $email . " has been added to our subscriber list</p>";
        else {
        	echo '<p>You must enter a valid email address. Please <a href="' . $_SERVER['PHP_SELF'] . '">try again</a></p>';
    else {
      <form action="signup.php" method="GET">
    	<input type="hidden" name="reason" value="Unsubscribe">
          <p class="bulletText pb10">Email</p>
          <p class="pb15">
              <input name="addr" type="text" class="textBox" value="Enter your email here" 
                     onfocus="javascript:if(this.value=='Enter your email here'){this.value=''}" 
                     onblur="javascript:if(this.value==''){this.value='Enter your email here'}" size="20" />
          <p class="pb15">
              <input type="submit" name="signup" value="" class="signUp"/>

<? } ?>


<?php include "footer.php"; ?>

Open in new window

Jason YuAsked:
Who is Participating?
Ray PaseurCommented:
MySQL support is being removed from PHP.

The basic extension was removed from the PHP distro years ago.  If you still wanted it (not a good choice) you were forced to install it yourself.  This was intended to be a "strong hint" about the future of PHP.  

A good path forward is to use MySQLi or PDO.  The article shows how to do this.
Jason YuAuthor Commented:
I read this article, but I still have some confusion.

How could I install mysqli module? Is it a file named which is the same as

Do I need download it and put it under the same directory as the other modules?

please advise, thank you.
Jason YuAuthor Commented:
I checked /usr/lib64/php/modules/ directory and didn't find a module named, could I just make the solution simply by copying a from another server to this one to make things work?

I am new to php, please advise with more detail, thank you. This issue has bothered me for over one week.

[root@point ~]# ls -alth /usr/lib64/php/modules/
total 2.2M
drwxr-xr-x. 5 root root 4.0K Apr 27 16:09 ..
drwxr-xr-x. 2 root root 4.0K Apr 27 16:09 .
-rwxr-xr-x. 1 root root  65K Oct 30 13:06
-rwxr-xr-x. 1 root root 1.8M Oct 30 13:06
-rwxr-xr-x. 1 root root  36K Oct 30 13:06
-rwxr-xr-x. 1 root root 256K Oct 30 13:06
-rwxr-xr-x. 1 root root  82K Oct 30 13:06
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Jason YuAuthor Commented:
I got the following error when I tried to install the php-mysql package.

[root@point tmp]# rpm -ivh php-mysql-5.4.40-1.el6.remi.x86_64.rpm
warning: php-mysql-5.4.40-1.el6.remi.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 00f97f56: NOKEY
error: Failed dependencies:
        php-pdo(x86-64) = 5.4.40-1.el6.remi is needed by php-mysql-5.4.40-1.el6.remi.x86_64
[root@point tmp]#
Jason YuAuthor Commented:
finally, I got the mysqli module loaded. But the install.php page still gives me error as below, could you please help?

Read Database Error:

Last Query:
SHOW TABLES WHERE Tables_in_BBE = 'bbe_admin'

#0  Database->notify() called at [/var/www/bbemod/includes/class.database.php:82]
#1  Database->query(SHOW TABLES WHERE Tables_in_BBE = 'bbe_admin') called at [/var/www/bbemod/includes/class.database.php:188]
#2  Database->isTableCreated(bbe_admin) called at [/var/www/bbemod/install.php:20]
Jason YuAuthor Commented:
Thank you, Ray, i will read all the links you gave me and learn PHP.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.