Shebang parsing

From: Date: Wed, 25 Jan 2012 23:22:57 +0000
Subject: Shebang parsing
Groups: php.internals 
Request: Send a blank email to internals+get-57512@lists.php.net to get a copy of this message
Hi, I currently work on a daemon implemented in PHP and as such, I want to keep all configurations in place while the php binary can be used by other cli scripts with the default /etc/php.ini file. I could recompile PHP and add a new folder to the folder which is scanned for php.ini files. A better idea would be a configuration with the shebang like this: #!/usr/local/php/bin/php -c /var/www/php.ini Unfortunately, this doesn't work on Linux due to a <del>bug</del> <ins>feature</ins> which keeps the shebang parameters as one string on argv[1]. There is already a ticket for this problem: https://bugs.php.net/bug.php?id=53034 My specific problem could be tackled in two ways: - Scan "." every time cli is called for a php.ini file or - Try to make argv interpretation more intelligent and parse/merge shebang parameters. The second solution, would also open the possebility to define constants or make use of all other cli parameters. Well, there's also a quick hack. We could change php_getopt() in order to make this a valid argument: php -c=/var/www/php.ini Anyway, I would provide a patch for the shebang parsing, but I wanted to put out my feelers what you think about this idea in general. I know, it's an OS problem, but we could work around this problem very quickly and improve the usability of cli scripts alot. Robert

« previous php.internals (#57512) next »