Viewed   48 times

Does anyone know why my require_once () or die(); is not working. It's always shown the Fatal error instead of the error message that I key in into the die(). See below for my code:

require_once ('abc.php') or die("oops");

Error message display as below

"Fatal error: controller::require_once() [function.require]: Failed opening required '1' (include_path='....."

instead of the message ("oops") I key in.



or has a higher precedence than require/require_once. Therefore php evaluates

('abc.php') or die("oops")

before passing the result to require_once. Or takes two boolean operands. ('abc.php') evaluates to true therefore the whole expression is true and

require_once true;

is invoked. require_once takes a string, bool(true)->string => 1 =>

Failed opening required '1'
You don't need the or die(...) there. If the file can't be read require_once will stop the php instance anyway.
Sunday, October 23, 2022

Here's what worked best for me when trying to script this (in case anyone else comes across this like I did):

$ pecl -d php_suffix=5.6 install <package>
$ pecl uninstall -r <package>

$ pecl -d php_suffix=7.0 install <package>
$ pecl uninstall -r <package>

$ pecl -d php_suffix=7.1 install <package>
$ pecl uninstall -r <package>

The -d php_suffix=<version> piece allows you to set config values at run time vs pre-setting them with pecl config-set. The uninstall -r bit does not actually uninstall it (from the docs):

vagrant@homestead:~$ pecl help uninstall
pecl uninstall [options] [channel/]<package> ...
Uninstalls one or more PEAR packages.  More than one package may be
specified at once.  Prefix with channel name to uninstall from a
channel not in your default channel (

  -r, --register-only
        do not remove files, only register the packages as not installed

The uninstall line is necessary otherwise installing it will remove any previously installed version, even if it was for a different PHP version (ex: Installing an extension for PHP 7.0 would remove the 5.6 version if the package was still registered as installed).

Monday, December 12, 2022

There are two problems with this.

The first is that you can be using parameterized queries. Look at PDO, this will help you greatly. Not only is this faster for multiple inserts, but you don't have to worry about SQL injection so much.

The second is that you can use MySQL's ON DUPLICATE KEY UPDATE to take care of this issue for you. Otherwise, when your query fails, you don't know why it failed. It may not have been a duplicate key issue at all!

Other than that, the code from the standpoint of or is just fine.

Thursday, December 15, 2022


if (input.find("end" || "End") != std::string::npos)


if (input.find("end") != std::string::npos || input.find("End") != std::string::npos)

Similarly for your other if.

It seems obvious what your expression means, but when you break it down it really doesn't make sense. find expects a string, and "end" || "End" is not a string.

Friday, August 26, 2022

Never used any of those, but they look interesting..

Take a look at Gearman as well.. more overhead in systems like these but you get other cool stuff :) Guess it depends on your needs ..

Friday, November 11, 2022
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :