PHP: Deprecated: The ereg extension is deprecated and will be removed in the future:

What can you do?
replace ereg() with @ereg()
or
set error reporting in php.ini to error_reporting = E_ALL ^ E_DEPRECATED
to eliminate the messages, but eventually you will have to port
or
port to preg_match()

you should know 4 main things to port ereg patterns to preg_match:

1. Add delimiters(/): ‘pattern’ => ‘/pattern/’

ereg(‘A-Z0-9a-z’,’string’); becomes preg_match(‘/A-Z0-9a-z/’,’string’);

eregi(‘pattern’,’string’); becomes preg_match (‘/pattern/i’,’string’);

2. Escape delimiter if it is a part of the pattern: ‘patt/ern’ => ‘/patt\/ern/’

Achieve it programmatically in following way:
$old_pattern = ‘<div>.+</div>’;
$new_pattern = ‘/’ . addcslashes($ereg_pattern, ‘/’) . ‘/’;

3. eregi(case-insensitive matching): ‘pattern’ => ‘/pattern/i’ So, if you are using eregi function for case insenstive matching, just add ‘i’ in the end of new pattern(‘/pattern/’).

4. ASCII values: In ereg, if you use number in the pattern, it is assumed that you are referring to the ASCII of a character. But in preg, number is not treated as ASCII value. So, if your pattern contain ASCII value in the ereg expression(for example: new line, tabs etc) then convert it to hexadecimal and prefix it with \x.

Example: 9(tab) becomes \x9 or alternatively use \t.

PHP: Deprecated: The mysql extension is deprecated and will be removed in the future:

gotta love this one, common PHP functions we have used for years are now going to be phased out, and we get warnings all over our pretty web page reminding us. How to fix

Option 1:
set error reporting in php.ini to
error_reporting = E_ALL ^ E_DEPRECATED

Option 2:
remove the warning by adding a ‘@’ before the function
such as:
$connect = @mysql_connect(‘localhost’,’root’,”);
or
ereg

Option 3:
Update your code to use the NEW functions (watch it, they changed around syntax on some
example:

$query = “Here the query you are going to perform”;

//QUERY PHP 5.4 o earlier (DEPRECATED)
$result = mysql_query ($query) or exit(“The query could not be performed”);

//QUERY PHP 5.5 (NEW EXTENSION)
$result = mysqli_query ($query) or exit(“The query could not be performed”);

note: ereg() has been replaced with preg_match()

XAMP – PHP – Fatal error: Call to undefined function mysql_connect()

Just installed the latest XAMP from ApacheFriends.org, and received this error.

WTF?

To fix, edit php.ini which is in XAMP home /php

unremmark  (remove the two ;;) from the line that contains ;;extension=php_mysql.dll

Now while I appreciate the work done on this free project, AMP does stand for Apache PHP-MYSQL,

one would assume that functionality would be “out of the box”. – silly me