Skip to content

Cannot set PHP temporary directory in CLI (sys_temp_dir) #828

@adamziel

Description

@adamziel

php-wasm-cli cannot create temporary files because it doesn't seem to use any custom sys_temp_dir value.

This program:

<?php
	var_dump(ini_get("sys_temp_dir"));
	ini_set("sys_temp_dir", "/tmp");
	var_dump(ini_get("sys_temp_dir"));
	var_dump(sys_get_temp_dir());
	var_dump(tmpfile());

Gives this output:

string(0) ""
string(0) ""
string(48) "/var/folders/sb/cywb762129g3f0jzq1_p2q5h0000gp/T"
bool(false)

When ran as:

nx run php-wasm-cli:start ./test.php

I tried feeding sys_temp_dir through php.ini and php.setPhpIniEntry without any luck.

Done is

Programs ran via php-wasm-cli can create temporary files and directories in the temporary dir defined by sys_temp_dir

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions