This extension allows PHP programs to access IBM i specific facilities, such as:
- Run CL scripts directly, and get their output, using similar interfaces that
already exist for
system
,exec
, andpassthru
- This allows running CL scripts in the context of the process; for example,
CHGJOB
will actually apply to the current job.
- This allows running CL scripts in the context of the process; for example,
- Get the current job and PASE CCSID, get the CCSID of files
While some of this was possible before, it required workarounds like calling into QSH or the FFI extension (which may be restricted). Some of it wasn't even possible at all.
Returns the current ASCII/PASE CCSID for the job.
Returns the current EBCDIC/job CCSID.
Returns an array with entries codepage
, ccsid
, and objtype
.
Their values are equal to the st_objtype
, st_codepage
, and st_ccsid
values returned by ILE stat.
Similar to the PHP function stat.
These execute CL commands in the context of the job.
The command is run with the PASE function systemCL. The output is captured and read out in a separate file descriptor.
Flags that can be given to change behaviour are:
IBMI_CL_SPAWN
: A new job is spawned for the CL.IBMI_CL_NO_MESSAGES
: Skip printing out IBM i messages i.e. "CPF0000".IBMI_CL_EBCDIC_OUTPUT
: Do not convert output from EBCDIC (assumed) to ASCII/Unicode.
Executes and prints output to stdout, while returning the last line as a string.
Equivalent to the PHP function system.
Executes and prints output to stdout.
Equivalent to the PHP function passthru.
Executes and returns the last line as a string.
If $output
is set, the array will be filled with each line of the output.
Equivalent to the PHP function exec.
Please see LICENSE
; this extension uses code from PHP and thus is kept under
the same license. Some files may be licensed under different, compatible
licenses; this will be marked in the header.
- PHP 7.3 or newer
- IBM i 7.2 or newer
There are no additional build options.
phpize --clean
phpize
# You may need to specify the build manually because autotools doesn't recognzie os400
./configure --prefix=$PREFIX --build=powerpc-ibm-aix
# libtool may only generate an .a file in modules, so force .so
make && cp .libs/ibmi.so modules/
make install
It would be useful to integrate other IBM i extensions, particularly those that do upcalls; such as the ones for authentication and XMLSERVICE fast paths. Such fast paths could benefit the Toolkit, in particular, if it provides enough of a performance benefit.
Perhaps generic IBM i FFI could be considered, but this is a bit of a risk. It would have to be disabled by default.