This page is about the PHP interpreter
environment inside the Riza Code Interpreter API.
We have not yet published an API client library for PHP.
Runtime
Riza runs the CGI version of PHP 8.2.6 compiled to WASM. The entire standard library is included. Because PHP is running in CGI mode (rather than CLI mode) there are a few quirks. For instance there are miscellaneous environment variables set that aren’t meaningful in the context of a standalone script. We’ve done some work to round off the rough edges, though there are limitations.Limitations
When PHP is running as a CGI program it doesn’t provide access to the constantsSTDIN
, STDOUT
and STDERR
and corresponding
php://stdin
, php://stdout
and php://stderr
I/O
streams. The php://input
and php://output
streams work as expected.
The PHP interpreter also doesn’t populate command line parameters in $argv
when running as a CGI program.
See our roadmap for planned future improvements.
Output
You can write tostdout
with echo
or using the php://output
stream.
Write to stderr
with
error_log
.
Input
You can read fromstdin
using the php://input
stream, and access environment
variables using $_ENV
. Unfortunately $argv
isn’t populated.