Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Warning: proc_open(): CreateProcess failed, error code - 267

A proc_open call like the following is failing with the above error.

<?php
$proc = proc_open($cmd, $ds, $pipes, '/tmp', array());

The command $cmd works correctly when executed directly.

like image 528
Sam Wilson Avatar asked May 18 '15 06:05

Sam Wilson


1 Answers

The problem has nothing to do with the actual command being executed.

Error code 267 is ERROR_DIRECTORY "The directory name is invalid." and in this case simply means that the /tmp directory doesn't exist on the drive that the code is being run from.

Instead of /tmp, use sys_get_temp_dir() (which one can assume will always exist).

like image 159
Sam Wilson Avatar answered Nov 17 '22 11:11

Sam Wilson