简体   繁体   中英

die() is not stopping code from executing

the problem is in the following:

echo 'Hello...';

die('I died...');

echo 'HAHAHA!!!';

on the web browser it is executing the echo after the die(). on the CLI stops on the die() and does not shows the echo as expected.

My Specs: PHP 7.4 (FPM) web server Nginx (also tried with apache with the same result)

Also I had a time long a test server on windows and it was exiting the script when exit or die was called, but somehow on the debian test server is not doing that.

is there something I am missing? do you guys have any tip?

Thanks in advance....

Update on 2022-07-27:

script: 在此处输入图像描述

Browser output: 在此处输入图像描述

CLI output 在此处输入图像描述

I've updated the PHP version (same happening): 在此处输入图像描述

@MarkusZeller yes is disabled the opcache: 在此处输入图像描述

still not working... but somehow on the windows server under php7.4.26 runs the script with the expected die

The development environment is windows with Debian 11 (WSL2) I have also tried it yesterday on a test machine I have in my home with base Debian 11 installed and it has the same issue. Same thing with the Debian 11 test server at work.

@YourCommonSense the script is the same. Here is the nginx path config: 在此处输入图像描述

Solution:

The cause of the problem was on the extension php-uopz . After installing every extension individually and testing after every install, the behavior only happens after this extension is activated. Hope this helps in case anyone runs into the same issue.

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