简体   繁体   中英

Call to undefined function define()

I'm getting this quite a lot on my WP site

PHP Fatal error:  Call to undefined function define() in index.php on line 14

The site works for several days (weeks in some cases), no one touches it, and then it suddenly starts logging these errors.

It's a Windows 2008 R2 box. Has PHP fallen over? How would I go about looking into it further. Restarting IIS fixes the issue.

Well, define is one of the core functions of PHP. Since line 14 of your code is the first function call and it is giving error on that line, therefore, your error is not about define function and you would get error for any function call. You can simply check this scenario by calling other core functions before that line.

By that finding, I was able to find a few related questions about fatal errors in IIS. It seems like your problem is duo to php.ini configuration file. Please read the following solutions:

If by any chance, that didn't work, it could be because of conflicts by your WP plugins. I'm not sure which plugins you have installed, but here are some related topics that could help you. You may be able to solve it by disabling some plugins:

You should realize that it is really hard to determine your problem without knowing more details about your PHP installation and WP configuration.

I had a similar problem and another define() solved it for me. The problem was a memory issue like @Latheesan said in the comments.

Please take a look at your php error_log to verify a memory issue.

Open your wp-setting.php file and add the below line almost on top of the file.

define( 'WP_MEMORY_LIMIT', '40M' );// you can try it with more or a bit less memory

You can find more helpful information here.

It's a Windows 2008 R2 box. Has PHP fallen over? How would I go about looking into it further. Restarting IIS fixes the issue.

It seems like a PHP bug. Please do not restart ISS and rather isoalte the issue in a single PHP file.

If the issue can be replicated, please submit it as a PHP bug.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM