[php] "Call to undefined function mysql_connect()" after upgrade to php-7

After I upgraded php5 to php7, I get an error 500 with

PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect()

I put this into my apt sources in order to get php7 right now:

deb http://packages.dotdeb.org jessie all
deb-src http://packages.dotdeb.org jessie all

What I basically did is:

apt-get remove php5
apt-get install php7-*

I'm using the current version of Debian Jessie.

But I still get this. There are a lot of questions here on SO and I definitely checked them all out. But I didn't find an answer there yet.

This question is related to php debian php-7

The answer is


From the PHP Manual:

Warning This extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0. Instead, the MySQLi or PDO_MySQL extension should be used. See also MySQL: choosing an API guide. Alternatives to this function include:

mysqli_connect()

PDO::__construct()

use MySQLi or PDO

<?php
$con = mysqli_connect('localhost', 'username', 'password', 'database');

Examples related to php

I am receiving warning in Facebook Application using PHP SDK Pass PDO prepared statement to variables Parse error: syntax error, unexpected [ Preg_match backtrack error Removing "http://" from a string How do I hide the PHP explode delimiter from submitted form results? Problems with installation of Google App Engine SDK for php in OS X Laravel 4 with Sentry 2 add user to a group on Registration php & mysql query not echoing in html with tags? How do I show a message in the foreach loop?

Examples related to debian

E: Unable to locate package npm How to update-alternatives to Python 3 without breaking apt? What is difference between arm64 and armhf? github: server certificate verification failed "Call to undefined function mysql_connect()" after upgrade to php-7 Debian 8 (Live-CD) what is the standard login and password? How to set the locale inside a Debian/Ubuntu Docker container? ps command doesn't work in docker container Forwarding port 80 to 8080 using NGINX Switching users inside Docker image to a non-root user

Examples related to php-7

PHP7 : install ext-dom issue mcrypt is deprecated, what is the alternative? PHP executable not found. Install PHP 7 and add it to your PATH or set the php.executablePath setting PHP 7 simpleXML How can I enable the MySQLi extension in PHP 7? PHP ternary operator vs null coalescing operator "Call to undefined function mysql_connect()" after upgrade to php-7 How do I install the ext-curl extension with PHP 7? PHP 7 RC3: How to install missing MySQL PDO PHP 7: Missing VCRUNTIME140.dll