Deprecated: Function ereg() is deprecated when install Drupal

At previous post about install drupal in localhost using wamp I got this message :

Deprecated: Function ereg() is deprecated in C:\wamp\www\drupal\includes\file.inc on line 902

That message appear because I use latest wamp software that utilize php 5.3.0 where ereg() function is deprecated.

Quick solution for this case are :

1. Downgrade wamp to previous version

or

2. Edit php source file of drupal.

I prefer to choose second solution since I love to learn new thing ๐Ÿ™‚

I have tried a few php function likeย  preg_replace() and mb_ereg()

After test each function I think mb_ereg() is good solution.

Back to the problem I open file :

file.inc

C:\wamp\www\drupal\includes\file.inc


scroll to line 902.

drupal_ereg

change ereg in line to mb_ereg to make the line transform into :

[sourcecode language=”php”]
elseif ($depth >= $min_depth && mb_ereg($mask, $file)) {
[/sourcecode]

Save the file and retry open http://batikweb.com

This time I got this :

install_drupal

Nice, I can continue to installation steps ๐Ÿ™‚

Stay health!

35 Comments

  1. Pingback: Step by Step Install Drupal on WampServer : Vhost and Clean URL | Hosting Formula

  2. Hi man,
    Thanks a lot for this solution. Great Job!

    But I have a question:
    Is the php function (ereg) equivalent to (mb_ereg) ? I mean does it do the same functionality for the include “file” in drupal, or it might result in a code weakness in future use of the function? Sorry, but I was not sure why it wasn’t amended by drupal core upon php 5.3 version! that what confused me not your fix ๐Ÿ™‚

    Keep it up..

  3. Thanks
    i got solution after read from your site thanks once again, i also got solution in eCommerce site where i was get same error. that was also solved.
    you really have new thing to developed and accept challenging error thanks a lot.

Comments are closed.