# sapi_getenv segfault

- Thread: https://externals.io/message/2224
- Original archive: https://news-web.php.net/php.internals/2224
- Started by John Kelly on 2003-06-08T16:07:15+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

---

## #2224 — John Kelly — 2003-06-08T16:07:15+00:00

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

Hi,

I made local patches in fopen_wrappers.c to get some apache
environment variables like:

  myptr = sapi_getenv("VH_VAR_ROOT", strlen("VH_VAR_ROOT") TSRMLS_CC);


But it's causing a segfault when used in php_fopen_with_path()

However, when used in php_check_open_basedir() it works fine.

I guess something related to the sapi has not been initialized yet
when the problems occurs, but I don't know enough about the PHP source
code yet, to see what that might be.

Can anyone tell me what to check for, before calling sapi_getenv()
