mirror of
https://github.com/php/php-src.git
synced 2025-08-19 17:04:47 +02:00
Fixed bug#41361 (shell_exec() does not find binaries)
This commit is contained in:
parent
e3d89c2faa
commit
e7c7f95ecd
1 changed files with 5 additions and 2 deletions
|
@ -352,12 +352,15 @@ int php_init_config(TSRMLS_D)
|
||||||
if (sapi_module.executable_location) {
|
if (sapi_module.executable_location) {
|
||||||
binary_location = (char *)emalloc(PATH_MAX);
|
binary_location = (char *)emalloc(PATH_MAX);
|
||||||
if (!strchr(sapi_module.executable_location, '/')) {
|
if (!strchr(sapi_module.executable_location, '/')) {
|
||||||
char *path;
|
char *envpath, *path;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
|
|
||||||
if ((path = getenv("PATH")) != NULL) {
|
if ((envpath = getenv("PATH")) != NULL) {
|
||||||
char *search_dir, search_path[MAXPATHLEN];
|
char *search_dir, search_path[MAXPATHLEN];
|
||||||
char *last;
|
char *last;
|
||||||
|
int pathlen = strlen(envpath) + 1;
|
||||||
|
path = malloc(pathlen);
|
||||||
|
memcpy(path, envpath, pathlen);
|
||||||
|
|
||||||
search_dir = php_strtok_r(path, ":", &last);
|
search_dir = php_strtok_r(path, ":", &last);
|
||||||
while (search_dir) {
|
while (search_dir) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue