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 10.100.2.107] PHP Fatal error:  Call to undefined function mysql_connect() in /var/www/bbemod/includes/class.database.php on line 51, referer: http://point.lacare.org/signup.php "


The PHP page signup.php is as following:

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

<div class="umTop">Signup for newsletter</div>
    <div class="umcont">
    
<?php
    if (isset($_GET['addr'])) {
        $email = $_GET['addr'];
        
        if (validate_email_addr($email)) {
        	Noemail::delete($email);
        
        	$sub = new Subscriber();
        	if (! Subscriber::find($email, $sub)) {
            	$sub->email_addr = $email;
            	Subscriber::save($sub);
        	}
        	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>
          <p class="pb15">
              <input type="submit" name="signup" value="" class="signUp"/>
          </p>
      </form>

<? } ?>

    </div>

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

Open in new window














'
Jason YuAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
MySQL support is being removed from PHP.
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/PHP_Databases/A_11177-PHP-MySQL-Deprecated-as-of-PHP-5-5-0.html

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.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jason YuAuthor Commented:
I read this article, but I still have some confusion.

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

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

please advise, thank you.
0
Jason YuAuthor Commented:
I checked /usr/lib64/php/modules/ directory and didn't find a module named mysql.so, could I just make the solution simply by copying a mysql.so 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 curl.so
-rwxr-xr-x. 1 root root 1.8M Oct 30 13:06 fileinfo.so
-rwxr-xr-x. 1 root root  36K Oct 30 13:06 json.so
-rwxr-xr-x. 1 root root 256K Oct 30 13:06 phar.so
-rwxr-xr-x. 1 root root  82K Oct 30 13:06 zip.so
0
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

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]#
0
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]
0
Jason YuAuthor Commented:
Thank you, Ray, i will read all the links you gave me and learn PHP.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.