Is it possible to load an extension from PHP cli interface, without modify the ini file?

后端 未结 3 1418
栀梦
栀梦 2021-02-04 07:25

I checked man php and output of php -h, but I didn\'t seem to find such thing.

But I remember seeing it somewhere, you could do something like

3条回答
  •  失恋的感觉
    2021-02-04 07:42

    Loading a regular extension via CLI is done with:

    php -dextension=abc.so myfile.php
    

    If your extension is not in the default path you can provide an absolute path as well:

    php -dextension=/path/to/abc.so myfile.php
    

    To load a Zend extension, it'd advisable to always pass an absolute path:

    php -dzend_extension=/path/to/abc.so myfile.php
    

提交回复
热议问题