5

I have such problem. On my system exit is not working at all. OS: Fedora 30, PHP 7.3.

Simple script:

<?php

exit;
exit();
exit(0);
exit(1);
exit("exit");

die;
die();
die(0);
die(1);
die("die");
echo "Hello world\n";

Output:

$ php check-exit.php 
Hello world

Why this happens? How to make exit to work as documented?

10
  • try to write exit() instead of exit Commented Oct 10, 2019 at 11:13
  • 4
    I can't reproduce that. It works for me Commented Oct 10, 2019 at 11:15
  • 1
    I'm not able to reproduce it either, so I'm guessing you're executing a different file, or without having saved it. Commented Oct 10, 2019 at 11:16
  • 1
    @RobinSingh PHP is a server-side language anyways, so the browser wouldn't really cache anything from it. ;-) Commented Oct 10, 2019 at 11:24
  • 1
    I removed php-pecl-uopz-6.1.1-1.fc30.x86_64 package from the system. Now works as expected. Commented Oct 10, 2019 at 11:48

1 Answer 1

7

Not working exit is a side effect of php-pecl-uopz package installed on my system. After removing the package the problem is gone. See uopz_allow_exit for details.

Sign up to request clarification or add additional context in comments.

1 Comment

In my case package is installed still getting this issue

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.