# Displaying a loggable error during PHP_MINIT_FUNCTION and suppressing the loading of the module.

- Thread: https://externals.io/message/51762
- Original archive: https://news-web.php.net/php.internals/51762
- Started by Richard Quadling on 2011-03-31T10:41:14+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #51762 — Richard Quadling — 2011-03-31T10:41:14+00:00

URL: https://externals.io/message/51762#51762

Hi.

I can use return FAILURE during PHP_MINIT_FUNCTION to stop a module
from loading and the appropriate message is displayed ...

PHP Warning:  PHP Startup: Unable to load dynamic library 'xxxxxx' -
The specified module could not be found.
 in Unknown on line 0

I want to restrict the module to only operate within the CLI SAPI.
Using config.w32, I've limited the module to windows only.

I can test the sapi ...

	if (strcmp(sapi_module.name, "cli") != 0) {
		return FAILURE;
	}

But I'd like to explain why the module cannot be loaded.

I've tried using zend_error() and php_error_docref() but I guess the
system isn't ready yet for these errors.

How do I generate an error (warning level I suppose), that will be
logged in the error log file.

Richard.
-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
