Calling php and setting a php.ini from within your plugin


Enter Your Query:
Use '%' for wildcards and quotes for "exact phrases"


Top Level » CustomBuild » ./build php
Top Level » DirectAdmin » API and Plugins

Calling php and setting a php.ini from within your pluginLast Modified: Jan 4, 2019, 11:05 pm
If you're running a plugin, and you need to use your own php.ini file, then use the following shebang line:

#!/usr/local/bin/php -nc/usr/local/directadmin/plugins/name/yourphp.ini

It's important that you use the -n option, especially with CustomBuild 2.0, or else you may have modules loaded twice due the hard-coded nature of the with-config-file-scan-dir, which could load extra ini files, loading modules twice (like zend/ioncube) which would cause errors.

You'll also notice that all php command line options and values are added as one shebang option.  Shebang only supports 1 extra option after the interpreter, so they must all be put together into 1 option. (Limitation of the shebang line design)

If you want to run php and not use any php.ini (internal defaults), then use:

#!/usr/local/bin/php -n

to force your php instance to ignore all php.ini settings you may have set in your global php.ini.


Debugging

It's been noted that if you've saved your files in "dos" mode, the shebang line (#!/usr/..) can often have issues with options after the space, like the -nc/usr.. flag.   Ensure you save your files is unix format.  To do this, you can use the dos2unix command, install if it's it's missing

yum install dos2unix
dos2unix index.html



© 2018 JBMC Software, Suite 173  3-11 Bellerose Drive, St Albert, AB  T8N 1P7  Canada.  Mon-Fri 9AM-5PM MST