mysql_* functions on PHP 5.5

+1 Miloslav Nosek · August 10, 2014
Hey guys,

I use a web app with old mysql_* functions and it keeps throwing function deprecated errors.
The logical approach would be to replace all of them with mysqli/pdo but the app contains about 4000 files (without images) in mvc
and many of other projects I'm working on are based on it so I can't do that and sadly, its also the reason why its impossible to just paste the code in here.

Setting error_reporting = E_ALL & ~E_DEPRECATED in /etc/php5/apache2/php.ini didn't help and
ini_set("display_errors", 0); with error_reporting(E_ALL ^ E_DEPRECATED); also made no difference.

When I was on Windows I simply downloaded php 5.4 and that worked perfect but now I transfered to Ubuntu 14.04 and this doesn't seem to be an option in here.

Is there any general solution for this issue?

Thanks to all your posts in advance :)

Post a Reply

Replies

Oldest  Newest  Rating
+1 David Tkachuk · August 10, 2014
Your solution is to stop using the old mysql_* functions, they're old, deprecated and insecure and will be removed in the future.
Please upgrade to PDO or MySQLi and use prepared statements.

If the PHP developers advise you not to use the mysql_* functions, then you know you shouldn't use it.
0 Miloslav Nosek · August 10, 2014
I don't use it. However company I work in has this app for ecommerce projects and try to imagine rewriting all these functions everytime client wants a little thing added to his website.
0 Shamal Sandeep · August 11, 2014
Use Mysqli or PDO instead of mysql. But native mysql is slightly faster than any of these methods. But PDO gives you full control to handle your databse. While Mysqli and PDO are object oriented.
  • 1

PHP

131,212 followers
About

Server-side, HTML embedded scripting language used to create dynamic Web pages.

Links
Moderators