Instaling drupal-6.13 ,i configured mysql database and users on that time showing this error.can any one resolve this problem

Function ereg() is deprecated in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\drupal\includes\file.inc on line 895

Comments

StormDruper’s picture

Hello,

I am a newbie and just installed wampserver 2.0 on Win XP (containing PHP 5.3.0) and then tried to install Drupal 6.13 and got the same error message above ("Deprecated: Function ereg() is deprecated in C:\wamp\www\drupal-6.13\includes\file.inc on line 895"). There seem to be a few other posts about this ... someone recommended simply replacing ereg() with preg_match(), but that leads to another series of messages for me: "preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash in C:\wamp\www\drupal-6.13\includes\file.inc on line 895". Has anyone successfully fixed this problem? Thanks for any help.

faux_codex’s picture

i'm a noob with this too, so i can't vouch that it won't break anything else but here's what worked for me (granted, i've only made the install work a few minutes ago and haven't tried to configure anything, but the error msg is gone now)

from the wamp tray icon>PHP>Version>Get more...
that should take you to the WAMP site and give you a list of of the PHP versions you can download
(i figured the depreciation came in v5.3.0) so i just downloaded the PHP 5.2.9-2 installer...
shut down WAMP
install 5.2.9-2 exe
restart WAMP
wamp tray icon>PHP>Version and then tagged 5.2.9-2
wamp tray icon>Restart All Services

again, i'm too much a noob to know if that's "proper" for now (and although i saw a similar "fix" post about replacing with the preg... i still was doing something wrong)

good luck, i'll post a followup if it appears that doesn't work (just going through a tutorial right now)

f_c

rpmckee’s picture

I degraded the php server and I got rid of the errors. I thought the problem had to do with Windows 7. Thanks again.

kishorekasina’s picture

thanks f_c
I got the ereg() deprecated error message and after following steps suggested by you, and selecting the wamp tray Icon > PHP > Double click on 5.2.11 and restarting all the services the error is gone now.

Thanks once again.
Regards
Kishore

alexanderpas’s picture

PHP 5.3 is not yet supported for Drupal 6

http://drupal.org/requirements

When it will be released, Drupal 7 will support PHP 5.3

less == more

Tecnoprint’s picture

Hello, also I have a problem installing WampServer 2.0 on Win XP (PHP 5.3.0) I can not and then tried to install Drupal 6.13 and much worse, I might say they did so you could install?

nanhe’s picture

it is very simple
open file
includes/file.inc
Goto line no 912
where you can see something like this
elseif ($depth >= $min_depth && ereg($mask, $file))

Now add @ sign before ereg($mask, $file)
copy below line past this line
elseif ($depth >= $min_depth && @ereg($mask, $file))

dungkal’s picture

hi nanhe,

your solution worked for me. thanks.

usoftng’s picture

bravo buddy, ur solution works perfecly

Bèr Kessels’s picture

That is not a good solution.
Simply supprressing the errors is the Tjernobil-way: remove the lightbulbs that warn for problems: and you no longer have a problem.
Somewhere down the line this is going to explode (again): a new module, a changed setting, an update and so on.

The real solution is to downgrade your PHP.

AdrianB’s picture

Downgrading PHP is not an option for many users of shared hosting whose hosting company have switch to PHP 5.3 (and many has, or will soon).

Heine’s picture

E_DEPRECATED is a distinct notice class about a potential _future_ problem. There are no problems with ereg in PHP 5.3 itself.

Users of PHP 5.3 should set the error_reporting level correctly on production servers, rather than modifying core.

zoscollaga’s picture

worked for me - i am using xampp on mac osx thanks!

pmorales77’s picture

Wow thanks!!!! it worked

gosperro’s picture

This is for me the best solution 'cause for me the downgrade was ackward, Thanks @nanhe

georgepliu’s picture

you are a geniei (that is a special form of genius). adding the @ before the ereg solved the problem.

thanks much

ecasanes’s picture

Awesome, that solution did work. I hope it will not get an error in the future and it will be a permanent workaround.

marmora’s picture

Thanks Alot .. it works :)

Web Agent’s picture

Good quick fix to get things going before moving to 7. Thanks for sharing.

purna_dey’s picture

Awesome nanhe!!! Your solution is working for me!

it is very simple
open file
includes/file.inc
Goto line no 912
where you can see something like this
elseif ($depth >= $min_depth && ereg($mask, $file))

Now add @ sign before ereg($mask, $file)
copy below line past this line
elseif ($depth >= $min_depth && @ereg($mask, $file))

Thanks,

vallikumar’s picture

This Worked for me.
Thank you so Much

orangeong2’s picture

Just what I'm looking for! Thanks!

StormDruper’s picture

I am in agreement with faux_codex's post above. I had the problems above ("Deprecated: Function ereg() is deprecated in C:\wamp\www\drupal-6.13\includes\file.inc on line 895") when I installed wampServer 2.0i (containing PHP 5.3.0) but have no such problem when I install wampServer2.0h (containing PHP 5.2.9-2). This isn't necessarily a "fix", as it appears that Drupal 6.13 still calls a function which is deprecated in PHP 5.3.0. So, for the time being, if you use a PHP version before 5.3.0, the problem should go away.

RayRay-1’s picture

If you prefer to keep PHP 5.3, you can always suppress the errors. In Drupal's includes/common.inc, find line 590. It should be listed as:

    if ($errno & (E_ALL ^ E_NOTICE)) {

Replace this line with:

    if ($errno & (E_ALL & ~E_NOTICE & ~E_DEPRECATED)) {

This will now always suppress the Deprecated error messages. If you have the developer tools module, you'll need to make the same change to devel/devel.module line 460.

Note that every time you update Drupal or the Devel module you'll have to manually make this change until they finally patch them to deal properly with php 5.3.

anu580’s picture

error is still there

kindly tell solution for Deprecated: Function ereg() is deprecated .

very urgent

Aravind’s picture

Change the line @ 590 in the file common.inc(drupal\includes) to if ($errno & (E_ALL ^ E_NOTICE ^ E_DEPRECATED)) {.. and the warnings are gone after a restart...

-Aravind

shunting’s picture

1. I had devel module also, so make sure if you do, you fix it there too, as RayRay above suggests.

2. Don't know what you mean by a restart -- no need to restart apache, this is drupal level; and in my experience, no need to restart the browser either.

Thanks for the help, all. This was aggravating and the noise made it hard to debug anything else.

pav’s picture

Sorry, ignore. Just realised it's a server side thing. Duh...

Hi, all.

I'm a complete noob - both at Drupal and PHP. I had the same problem. Downgrading to an earlier vesion of PHP has worked for me. This fixes the problem on my side, but the thing that worries me is whether a similar problem may surface when other people view the website.

Pav

astra’s picture

For my sites I got the same problem after upgrading php 5.3:

Function ereg() is deprecated in .../includes/file.inc on line 644.

In includes/common.inc replace the line ( line 494 for D 4.7, line 592 for D5):

if ($errno & (E_ALL ^ E_NOTICE)) {

with the new one:

if ($errno & (E_ALL & ~E_NOTICE & ~E_DEPRECATED)) {

The problem is resolved. Thanks!

Druid’s picture

The problem is not resolved, at least in any permanent sense. It's merely swept under the rug. Eventually your host will upgrade to a PHP version which does not permit you to do this, probably because those deprecated functions will have actually been removed from the language.

You're best off properly addressing the situation by upgrading your software (such as Drupal) to a version that is PHP 5.3 compatible. N.B.: PHP 5.4 is now becoming commonplace, and before you know it, 5.3 will be out of support.

webghost’s picture

error_reporting =E_ALL & ~E_DEPRECATED
All will work

gopisadanam’s picture

Agree with webghost. Only want to add that I had to make the change in the php.ini file in the c:\wamp\bin\apache\Apache2.2.11\bin folder.
On further inspection, I am still getting it. Had to do modify line 590 in drupal\includes\common.inc as stated and deprecated messages went away. Still having some warnings though!

RayRay-1’s picture

Many people have hosted accounts where they don't have the option to edit their php.ini. Also, editing php.ini will turn off the deprecated warnings for ALL php code not just Drupal. If your turning them off on your local machine while developing, as soon as you migrate your code to a hosted system the errors will appear again in an environment where you can't mess with PHP's configuration.

In general it's good to get these warnings but suppress them at the application layer--you want these errors when your writing your own code so you can avoid using those function. Come the next round of PHP, the deprecated functions are going bye-bye and if you don't heed the warnings you (or whoever inherits your code) will be stuck.

Drupal will probably resolve them in a few months, but until then I highly recommend patching the broke application and leaving PHP alone.

jacobdavid’s picture

Thanks

It worked for me

Jacob

thebuckst0p’s picture

This doesn't work for me, because Drupal's custom drupal_error_handler() ignores the error_reporting settings (as it's supposed to). So only the core hack to common.inc works for me. Did anyone get the error_reporting method to work without the core hack?

VM’s picture

upgrade to drupal 6.14 which supports PHP 5.3 and therefore needs no patching at all.

jesdnissen’s picture

Thanks. Works with Ubuntu 9.10, LAMPP/XAMP 1.7.3a (with php.ini in /opt/lampp/etc/) without further corrections, but I have not installed modules yet.

AdrianB’s picture

I used this in my .htaccess file:

php_value error_reporting 4096

That solved the deprecated warning for my setup (XAMPP on Mac).

carmelos’s picture

I'm using also XAMPP, but on PC. I have changed the file you mentioned in main drupal directory in section: # PHP 5, Apache 1 and 2.
but I still wonder: what exactly is the meaning of this entry, do you know?

ethanw’s picture

Can also use settings.php to set this param, which helps with drush errors as well as web-based.

Add this line to the ini_set section of the default settings.php:

ini_set('error_reporting', 4096);

--
ethan winn
http://colab.coop

bobsawey’s picture

ethanw and adrians solution works for me

thanks folks.

locotevra’s picture

hello adrian. i saw you used xampp on mac. any opinion about the thing below. thanks
I use XAMPP to MAC OS X 1.7.2
in 10.6.2 SNOW LEOPARD
I put drupal files in htdocs and when i start install page i received the text below. any help. i am new in Mac and Drupal.

Deprecated: Function ereg() is deprecated in /Applications/XAMPP/xamppfiles/htdocs/drupal/includes/file.inc on line 902

Deprecated: Function ereg() is deprecated in /Applications/XAMPP/xamppfiles/htdocs/drupal/includes/file.inc on line 902
Warning: Cannot modify header information - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/drupal/includes/file.inc:902) in /Applications/XAMPP/xamppfiles/htdocs/drupal/includes/install.inc on line 618

Warning: Cannot modify header information - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/drupal/includes/file.inc:902) in /Applications/XAMPP/xamppfiles/htdocs/drupal/includes/install.inc on line 619

Is it something with PHP module o what. Somebody tell em change to old version php (5.2).
thanks again
fabian

AdrianB’s picture

Did you put this in your .htaccess file as I wrote above?

php_value error_reporting 4096

Remember that .htaccess files are invisible in Finder, so you'll either need to use the Terminal or a text editor that can open hidden files.

Otherwise, try ethanw's solution above, I think it's even better.

ipmurali’s picture

I am using XAMPP 1.7.2 for linux

I changed the php.ini, the line
error_reporting=E_ALL | E_STRICT
changed to
error_reporting=E_ALL & ~E_DEPRICATED

still i could not run the install.php, throwing the same error

appreciate help to resolve this issue.

-ds-’s picture

http://drupal.org/node/537950#comment-1879688

and fixed the problem by going to the wampserver icon, clicking on "PHP >> Version >> get more" and then downloaded and istalled version 5.2.9 Then I went back to the same place and changed the active version to the 5.2.9, refreshed the page and everything looked correct.

ipmurali’s picture

thanks ds
for wampserver the suggested method will work.
what about for XAMPP

-ds-’s picture

Hi Murali,

I don't see why not. The issue is with PHP, because, as the errror already states: http://uk.php.net/function.ereg

Warning

This function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 6.0.0. Relying on this feature is highly discouraged.

So if xampp is running php 5.3.0 you'll have to find a version of xampp that uses php version 5.2.9.

Read this: http://drupal.org/node/360605

SergFromSD’s picture

Thanks ds. I checked to see what version of php I'm running in my production environment (which was 5.2.8) and followed your directions but installed 5.2.8. Problem went away, and now my local environment matches my expected production envrionment which is always good.

kenorb’s picture

thanks, it worked

ck’s picture

you have to have matching php.ini and common.inc error reporting for all this to work i.e.:

in php.ini: E_ALL & ~E_NOTICE & ~E_DEPRICATED
and
in common.inc: E_ALL & ~E_NOTICE & ~E_DEPRICATED

mr.perseids’s picture

Hi all,

Function ereg() is deprecated in drupal-6.13\includes\file.inc on line 895
open the file.inc in a good text editor other than notepad, go to the line number 895 to see the following line. Then comment the line and in the next line type the replaced code. this will solve the instalation issues and also most of other issues related to the same issue.

Change

elseif ($depth >= $min_depth && ereg($mask, $file)) {

to

elseif ($depth >= $min_depth && mb_ereg($mask, $file)) {

mb_ereg fortunatly is not deprecated

robballan’s picture

Worked fine. Thx.

aquila_au’s picture

Thanks for that, works a treat.

sami_nowhere’s picture

yes, it works. Thanks for sharing.

zd370’s picture

that seems to work.. i wonder if preg_match would work as well??

elseif ($depth >= $min_depth && preg_match($mask, $file)) {
willazilla’s picture

Thank you!

The preg_match change did not work.

The change to my common.inc file did not work on my platform.

But,

elseif ($depth >= $min_depth && mb_ereg($mask, $file)) {

did.

Yay! Yay! Yay!

guatebus’s picture

thank you for the fix mr.perseids

annasm’s picture

Hi all,

I've edited the file.inc file and now it works fine: no more function ereg() deprecated error message.
But when I'm trying to install drupal on my localhost I just can get to the first steps: configuration of database...once I click save and continue it takes a long time to say "done" and I've got a blank page.
I'm using localhost listening for port number 5001 and also using another language instead of english.
Does anyone know what can be the problem? I need to do it quite quickly and I'm blocked.
Thanks!!

RainDruplets’s picture

Thank you Mr.Perseids. For Xampp 1.7.3a on Linux Server running the latest PHP 5.3.x this change solved the problem.

vishun’s picture

hey there,

replacing ereg() with mb_ereg() was the proper solution for my setup which was not related to wamp or anything else.

i've got a dedicated server running Centos with cPanel (and apache) and this error sprung up as a direct result of setting up FastCGI support for php. cPanel uses CGI as opposed to FastGGI when it comes to php and in EasyApache there is an option for "Mod FCGID" which is the cPanel equivalent of FastCGI. Anyway! This error sprung up directly after enabling this support, which was because we're running lighttpd for a specific use and apache for everything else.

Not sure if this may help drupal ultimately resolve this issue, but due to the changes that were recently made i think its safe to assume that this is capable of being replicated in a similar setup.

Also i agree with a lot of other peoples statements that hiding deprecated errors is not particularly the solution, because its still failing whenever it needs to use that function. Replacing ereg() with mb_ereg() so in theory it still works properly is IMO the proper solution. Wondering if it might be able to use either depending on availability.

Heine’s picture

This is not related to fastcgi, but to configuration.

Calling ereg still works; so no failure there. Using mb_ereg is also cheating. It appears as though the PHP devs forgot to throw an E_DEPRECATED on use of that function.

chamithadealwis’s picture

Fixed my problem too. Thank you very much.

t4him’s picture

I just installed wamp (removed xampp) and got this error on my first drupal 6x install. I changed the files.inc file and it works fine. Thanks!

rear_wheel_drive’s picture

Same problem, same "file.inc" fix for me on Vista.

cethink’s picture

It's done for me where I used xampp 1.7.2

Really thx

serg2’s picture

Workaround mentioned works fine but would suggest getting php & drupal versions that are fully compatible. Whilst the workaround does work you may get further error messages (maybe the line 460 one).

Either way get the versions that line up.

samiaafshin’s picture

I am a newbie using Drupal. I installed xampp, later I installed Drupal 6.13, as soon as I could finish with the installation Function ereg() error starts appearing as well as there are alot of warnings that also appear such as: warning: Parameter 3 to block_user() expected to be a reference

I am not sure why all this is happening, can anyone help me in this regard?

Thanks,
Samia

shakaama’s picture

Thank you for the file.inc fix.

I used notepad 2, went directly to the line 895 and fixed it. brought wamp back up, even have xampp still installed, and it worked perfectly. the question is though, if i upload that to my host will that still happen? And, then what do i do? Do i have to install php 5.2.10? which i'm confused how to do exactly.

I spoke too soon. after going to the install it goes to the 2nd screen and stops. when i refresh i get:

* warning: Parameter 3 to block_user() expected to be a reference, value given in C:\wamp\www\drupal2\includes\module.inc on line 450.
* warning: Parameter 3 to comment_user() expected to be a reference, value given in C:\wamp\www\drupal2\includes\module.inc on line 450.
* warning: Parameter 2 to dblog_user() expected to be a reference, value given in C:\wamp\www\drupal2\includes\module.inc on line 450.
* warning: Parameter 2 to node_user() expected to be a reference, value given in C:\wamp\www\drupal2\includes\module.inc on line 450.
* warning: Parameter 3 to system_user() expected to be a reference, value given in C:\wamp\www\drupal2\includes\module.inc on line 450.
* warning: Parameter 2 to user_user() expected to be a reference, value given in C:\wamp\www\drupal2\includes\module.inc on line 450.

:( i fixed one thing to get another.

and now when i try to install drupal, inputing the database name and database username and clicking save just refreshes the page and erases what i've input.

youkho’s picture

There's maybe a solution on http://devthought.com/tumble/2009/06/fix-ereg-is-deprecated-errors-in-ph...

Don't know if it will work or not

sajosh’s picture

For those using XAMPP on windows (perhaps other platforms too) and Drupal 5 or Drupal 6 less than minor version 13, install XAMPP 1.7.1 not 1.7.2. The latter (1.7.2) has PHP 5.3 which is not supported until D6.14.

Here's one place to get 1.7.1 ...
http://sourceforge.net/projects/xampp/files/

I had this depreciation and many other problems with 1.7.2 so i just uninstalled it and put 1.7.1 and now it works.

Hope this helps some of you.

yenidem’s picture

I had got this error and i use wampserver on wındows 7. the error gets for php version 5.3.
Click the wampserver icon there is PHP menu, and under PHP memu there is PHP version menu, click the get more or click the link that i submitted below. than change the php version to 5.2.11.

http://sourceforge.net/projects/wampserver/files/WampServer%202%20-%20Ex...

ptrupek’s picture

change lines 898-902 with:

        $mask2 = str_replace("\\", "", $mask);
        $mask2 = str_replace("$", "", $mask2);
        if (is_dir("$dir/$file") && $recurse) {
          // Give priority to files in this folder by merging them in after any subdirectory files.
          $files = array_merge(file_scan_directory("$dir/$file", $mask, $nomask, $callback, $recurse, $key, $min_depth, $depth + 1), $files);
        }
        elseif ($depth >= $min_depth && strpos($file, $mask2)!==false) {
bryanhidalgo’s picture

Thank you so much, I had exactly the same problem, that solved other issues too.

meeta’s picture

problem sloved by replacing " if ($errno & (E_ALL ^ E_NOTICE ^ E_DEPRECATED)) " at line line no 580 in common.inc.

Thanks folks!

Lehtóri’s picture

Thats not solving the problem, you're just hiding the error message.

jinssebastian’s picture

when am trying to install drupal , am getting the error- Deprecated: Function ereg() is deprecated in C:\wamp\www\drupal\includes\file.inc on line 902-plz can any one help me

urolicious’s picture

For the error- Deprecated: Function ereg() is deprecated in C:\wamp\www\drupal\includes\file.inc on line 902
Go to: http://www.hostingformula.info/deprecated-function-ereg-is-deprecated-wh...
and you'll find the instructions to solve this problem there. Worked a charm for me :D

Rocksam’s picture

I'm not an expert on regular expressions
For some reason the regular expression in preg_match() needs to be placed between /-characters.
So I modified the code in file.inc on line 902 to be

/* replace ereg() with preg_match() */
elseif ($depth >= $min_depth && preg_match("/$mask/", $file)) {

I don't know if the functionallity is 100% the same, but it seems to work, and the warning does not show up anymore

mak1e’s picture

yes both functionality is basically the same except that ereg/eregi~ functions are POSIX("Portable Operating System Interface [for Unix]") RegEx functions while preg~ are PCRE (Perl-Compatible RegEx) which is much faster that POSIX, but I guess still not a reason to depecrate them :( bad dog(php)!

Anyway I had the same issues with previously built website applications, and now have to comply with the latest version.

Also if you are using eregi~ which are the case-insensitive version of ereg~.

Basically, to make the pattern match characters in a case-insensitive way, append i after the delimiter:

/* replace eregi() with case-insensitive preg_match() */
elseif ($depth >= $min_depth && preg_match("/$mask/i", $file)) {

Goodluck to us all! ;)

nanhe’s picture

it is very simple
open file
includes/file.inc
Goto line no 912
where you can see something like this
elseif ($depth >= $min_depth && ereg($mask, $file))

Now add @ sign before ereg($mask, $file)
copy below line past this line
elseif ($depth >= $min_depth && @ereg($mask, $file))

praveenks’s picture

thanks for your help but still am having the problems

1. Not able to see the status report, page is blank.

2. If i want to change the password of newly created user it displays only warnings like

* warning: Parameter 3 to block_user() expected to be a reference, value given in C:\wamp\www\icpl\includes\module.inc on line 386.
* warning: Parameter 3 to comment_user() expected to be a reference, value given in C:\wamp\www\icpl\includes\module.inc on line 386.
* warning: Parameter 2 to contact_user() expected to be a reference, value given in C:\wamp\www\icpl\includes\module.inc on line 386.
* warning: Parameter 3 to locale_user() expected to be a reference, value given in C:\wamp\www\icpl\includes\module.inc on line 386.
* warning: Parameter 2 to node_user() expected to be a reference, value given in C:\wamp\www\icpl\includes\module.inc on line 386.
* warning: Parameter 3 to system_user() expected to be a reference, value given in C:\wamp\www\icpl\includes\module.inc on line 386.
* warning: Parameter 2 to user_user() expected to be a reference, value given in C:\wamp\www\icpl\includes\module.inc on line 386.
* warning: Parameter 2 to watchdog_user() expected to be a reference, value given in C:\wamp\www\icpl\includes\module.inc on line 386.
* warning: Parameter 3 to block_user() expected to be a reference, value given in C:\wamp\www\icpl\includes\module.inc on line 386.
* warning: Parameter 3 to comment_user() expected to be a reference, value given in C:\wamp\www\icpl\includes\module.inc on line 386.
* warning: Parameter 2 to contact_user() expected to be a reference, value given in C:\wamp\www\icpl\includes\module.inc on line 386.
* warning: Parameter 3 to locale_user() expected to be a reference, value given in C:\wamp\www\icpl\includes\module.inc on line 386.
* warning: Parameter 2 to node_user() expected to be a reference, value given in C:\wamp\www\icpl\includes\module.inc on line 386.
* warning: Parameter 3 to system_user() expected to be a reference, value given in C:\wamp\www\icpl\includes\module.inc on line 386.
* warning: Parameter 2 to user_user() expected to be a reference, value given in C:\wamp\www\icpl\includes\module.inc on line 386.
* warning: Parameter 2 to watchdog_user() expected to be a reference, value given in C:\wamp\www\icpl\includes\module.inc on line 386.

can anybody suggest the solution? thanks for any help.

irinaz’s picture

worked like a charm!

progone’s picture

thanks for the soluton to our 'Function ereg() is deprecated' issues.

Barry_Fisher’s picture

.htaccess workaround

I upgraded to Ubuntu 10.4 and starting getting this error.

See the Drupal requirements. Drupal doesn't yet support PHP 5.3.

Here is another solution/workaround for those who still want to use PHP 5.3:

Put the following lines in your .htaccess file:

# set php error reporting to E_ALL & ~E_NOTICE & ~E_DEPRECATED
# PHP 5.3 workaround
php_value error_reporting 22519

Your results may vary depending if your host allow PHP config directives in the .htaccess file. Obviously any core updates will still override this file but to my mind it's less of a Drupal core hack.

If you are wondering how I came up with the figure of 22519- it is a bitwise value for setting PHP's error reporting parameters. If you have php-cli installed you can run this command at the command line to determine which reporting data suits your set up best, mine was:

$ php -r "print E_ALL & ~E_NOTICE & ~E_DEPRECATED;"

If you don't have access to the command line just execute this in a separate script:

<?php print E_ALL & ~E_NOTICE & ~E_DEPRECATED; ?>

The various reporting options can be found on PHP's error reporting manual page.

Barry

--
Barry Fisher

Pivale

AdrianB’s picture

See the Drupal requirements. Drupal doesn't yet support PHP 5.3.

Well, the Drupal requirements clearly stats that Drupal 6.14 and above and Drupal 7 supports PHP 5.3, it's only Drupal 5 that doesn't support PHP 5.3:

PHP 5.3 is not yet supported by Drupal 5.x, but is supported by Drupal 6.14 core and higher (see the release notes for 6.14) and also by Drupal 7.x.

The big problem with PHP 5.3 right now is not core but the many contributed modules which aren't updated yet, or requires dev version or even patches.

Barry_Fisher’s picture

Sorry- looks like Drupal 6.14+ does actually support PHP 5.3. However the issue I was getting was reported in file.inc - part of core, so this still ought to have a patch to use non-deprecated functions.

--
Barry Fisher

Pivale

AlanAtLarge’s picture

Subscribe

BonAro’s picture

Hi Drupal friends,

I just installed WAMP and then Drupal. When I try to run my localhost the system writes

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

Since I tried 3 times and was following the Lynda.com tutorial video step by step, I wonder what is wrong with my installation. Thanks for helping.

Take care

shahzadanjum’s picture

Nanhe
elseif ($depth >= $min_depth && @ereg($mask, $file))
Thank You Very Much Your Solution is 100% Perfect

virtualjoker’s picture

People, never do that in your php's code, @ is always a very bad solution.

Warning
This function has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged.

Let's try another solution !

Imteaz Ahmed’s picture

Hi, as I fill the boxes of database name, user name, but the window repeats every time. So I cannot start creating my website.

prva-damaa’s picture

I have the same problem and can solve it

Anomalous Underdog’s picture

I have the same problem

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Deprecated: Function ereg() is deprecated in C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc on line 926

Warning: Cannot modify header information - headers already sent by (output started at C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc:926) in C:\Inetpub\wwwroot\Dzz\Drupal\includes\install.inc on line 618

Warning: Cannot modify header information - headers already sent by (output started at C:\Inetpub\wwwroot\Dzz\Drupal\includes\file.inc:926) in C:\Inetpub\wwwroot\Dzz\Drupal\includes\install.inc on line 619

I'm using Apache 2.2, PHP 5.3, and Drupal 6.17

Druid’s picture

Do not waste our time by posting the same error message over and over and over and over and over. One will do nicely.

The "Cannot modify header information" error is a consequence of the "Deprecated" warnings, and will go away once you deal with the Deprecated warnings.

The file.inc problem can be fixed by either following the instructions to suppress the warning (~E_DEPRECATED) or changing the ereg() or ereg_replace() calls with preg_match() or preg_replace(). Basically you need to put delimiters in the pattern:
$regex = '/\.('. ereg_replace(' +', '|', preg_quote($extensions)) .')$/i';
in includes/file.inc becomes
$regex = '/\.('. preg_replace('/ +/', '|', preg_quote($extensions)) .')$/i';
and
elseif ($depth >= $min_depth && ereg($mask, $file)) {
becomes
elseif ($depth >= $min_depth && preg_match("/$mask/", $file)) {
(that assumes that there are no / in $mask. If there are, they need to be escaped \/ or use different delimiters, such as "|$mask|" or "#$mask#")

And while you're at it:
if (!$bom && ereg('^<\?xml[^>]+encoding="([^"]+)"', $data, $match)) {
in includes/unicode.inc becomes
if (!$bom && preg_match('/^<\?xml[^>]+encoding="([^"]+)"/', $data, $match)) {
and
$data = ereg_replace('^(<\?xml[^>]+encoding)="([^"]+)"', '\\1="utf-8"', $out);
becomes
$data = preg_replace('/^(<\?xml[^>]+encoding)="([^"]+)"/', '\\1="utf-8"', $out);

Will someone rattle the developers' cages and get these fixed if they're not already in 6.18? I don't know which is line 926 in 6.17's version (I'm guessing the second block, which is 911 in 6.16).

BrightBold’s picture

I guess I'll just downgrade WAMP to php 5.2.11 (note: if you do this you need to be sure to downgrade MySQL also), but I just upgraded to 5.3 because my understanding was that Drupal 6 supported that now. Downgrading means I'll have to re-set my environment variables or Drush will stop working. So it would be nice to solve this - all the solutions I saw above seemed problematic (although I may have missed a good one).

beryl’s picture

For future reference, ereg has been replaced with preg_match and preg_replace because it is faster and uses better regexp syntax.

http://devthought.com/tumble/2009/06/fix-ereg-is-deprecated-errors-in-ph...

You cannot just replace ereg with preg_match since the you have to enclose the regexp inside / ... / to make it work. Also note that lowercase uppercase must be written outside the enclosure like this / ... /i

Druid’s picture

I think we can all agree that PHP development really screwed up by outputting to the screen an error message for each deprecated function call, rather than logging a friendly reminder just once in an error log file. That's like using a wire brush chucked in an electric drill to scratch an itchy nose.

These functions were due to be removed in PHP 6.0, but last I heard, development on 6.0 has been suspended while they work out some problems of some sort. Since 5.3 is still giving "deprecated" warnings, it would be safest to assume (until we hear official word otherwise) that the ereg() family functions will still disappear at some point. I would not expect PHP development to permanently halt, so eventually there will be a PHP 6.0. Whether it still removes ereg() family functions, I haven't heard official word on. Even if it doesn't, PHP 5.3 will still take a while to pass through the pipeline, so we'll be seeing these warnings for a while yet.

You can certainly suppress the error messages, and wait for Drupal development to finish removing the ereg() family functions (they're not completely out as of 6.17), or for PHP to announce a revised roadmap that leaves them in (and PHP 5.x stops giving warnings). It's much, much better to properly use the E_DEPRECATED setting value in ini.set() or in php.ini settings than it is to use "@" to suppress all messages (not just the deprecated warning). You don't want to suppress a warning that, say, a bad regular expression has been given.

You can go ahead and change the PHP code (as of 6.17, there are 4 ereg* calls in the base code), but some people frown upon meddling with the core code. Pick your poison. It shouldn't hurt to make 4 small changes to the code (with no interface changes), but be very, very careful not to break the code and be embarrassed by reporting a bug against what you broke!

hayatu4islam’s picture

I'm new with wampserver so I was trying to use pattern matching, i was encountering some errors like this:
Deprecated: Function eregi() is deprecated in C:\wamp\www\ctrl.php on line ...

Druid’s picture

http://us.php.net/manual/en/migration53.deprecated.php lists deprecated functions and their replacements. For eregi("pattern", var) it would be preg_match("/pattern/i", var).

knx7’s picture

Hi,

I think that hiding the problem is a good solution here, caus' ereg still work even if it's deprecated but it is slower than preg_match that is the equivalent in PCRE of ereg. So adding a '@' just before ereg (@ereg) work.

I tried to change ereg by preg_match("/".$mask."/", $file) and it worked for me. But i didn't make a lots of tests. So i don't know if they are side effects.
Ereg and Preg_match have not the same return value. ereg will return the size of the first occurence found in the string, and FALSE if it don't find anything.
Preg_match will return 1 if it finds an occurence, and 0 if not.
0 is like a FALSE, and 1 or any other number are TRUE.

Apparently, they don't use the returned value of ereg($mask, $file) because they don't save it in a var. The function is just called for the test.

So... Why this wouldn't work ? Just hope that they properly backslash slashes !

Heine’s picture

Because the ereg and preg masks are not compatible. AFAIK there's at least one contrib module that would break on this change.

So, use the core fix from the PHP 5.3 compatiblity issue.

Druid’s picture

The problem with just hiding the "deprecated" error with a @ is that you will forget that you did that. The same goes, more or less, for telling PHP to ignore deprecated function warnings (but the code change is in just one place). One day your host will upgrade PHP to a level that no longer includes these functions*, and you'll be scratching your head over why your site is thoroughly broken. If you know that your site will be discarded soon, you might choose to get away with it, but in the long run, you're better off fixing the code once and for all, and being done with it.

If you're going to go in and stick a @ in front of every ereg() etc. call, you might as well take a few seconds more to change it to the correct preg_match() etc. call and be done with it. That's the difference between slapping a Band-Aid on a gash and getting it sewn up.

* Even though PHP 6.0's future is uncertain, these functions could still disappear relatively soon.

samatech7’s picture

I was also having the same problem
your code was excellent. it worked but now i have encountered another error again.

warning: Parameter 1 to theme_field() expected to be a reference, value given in /Applications/XAMPP/xamppfiles/htdocs/mcomps/includes/theme.inc on line 171.

any help is highly appreciated

nanhe’s picture

function validateEmail($email){
return ereg("^[a-zA-Z0-9]+[a-zA-Z0-9_-]+@[a-zA-Z0-9]+[a-zA-Z0-9.-]+[a-zA-Z0-9]+.[a-z]{2,4}$", $email);
}
when i writing this function then following error generate i am using PHP Version :
5.3.0
precated: Function ereg() is deprecated in D:\wamp\www\evenoid\components\com_user\models\user.php on line 6
when i simplye @sing the before ereg function problem solve....
it is not easy change your php version on hosting account it is very easy localhost

Thanks
Nanhe Kumar

zd370’s picture

why do you want to use deprecated function anyways???

http://php.net/manual/en/function.ereg.php

use preg_match

http://www.php.net/manual/en/function.preg-match.php

Druid’s picture

All you're doing is suppressing error messages from ereg. These would include not only warnings that it's deprecated, but also genuine errors. Besides, you'll forget you did that, and some day your host will upgrade to PHP 6.0 or whatever and bang! Your code doesn't work at all because ereg() no longer even exists. Then you'll have to frantically go through and fix all these things. If you're going to go through the effort of editing anyway, why not do it right the first time and replace deprecated functions?

waterproofmp3’s picture

Can this work for php version php 5.3.0.? I'm not sure if this version is causing the error itself.

Summit’s picture

Bookmarking, http://drupal.org/node/514334#comment-3236364 worked for me!
greetings, Martijn

kingandy’s picture

Suppressing this particular error message is the chosen fix - see http://drupal.org/node/360605#comment-3055372. I think it's basically because 6.x is not the "current" version of Drupal, so the software is not "relying" on the function existing in future development. They're fairly certain that Drupal 6 will be phased out before ereg is removed from PHP.

++Andy
Developing Drupal websites for Livelink New Media since 2008

deepakjoshi’s picture

I also get this problem and solved by doing small steps as below

1. Open file in folder includes/file.inc
2. at line 941 replace ereg() with mb_ereg()

Now check it will fix

Cheers

paskainos’s picture

It seems there are two divergent paths one might take, based on proposed solutions offered. Since the Win7/WAMP environment is mentioned extensively (exclusively?) here regarding the PHP5.3 compatibility issue, perhaps the quick (temporary) fix is in order for the local[host] (WAMP) dev environment, with the intention of un-suppressing the ereg() Function in production, since most production servers are still running PHP5.2x. For online development, another (permanent) approach would be in order if production servers are running PHP5.3.

dustinschaeffer’s picture

JadeZenna’s picture

I'm completely new to working with Drupal.

Already have WP and Joomla (Oh, not sure if I'm allowed to use those words on this forum) installed locally.

Trying to do the same with Drupal.

This thread will do the job nicely, thank you.