php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72780 PHP -i and -m do not work with -c
Submitted: 2016-08-08 09:23 UTC Modified: 2016-08-08 10:02 UTC
Votes:6
Avg. Score:4.0 ± 1.0
Reproduced:5 of 5 (100.0%)
Same Version:5 (100.0%)
Same OS:5 (100.0%)
From: gooh@php.net Assigned:
Status: Open Package: CGI/CLI related
PHP Version: 7.0.9 OS: any
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2016-08-08 09:23 UTC] gooh@php.net
Description:
------------
When running CLI with the -i or -m flags, one has to specify -c before those to use a custom ini file, otherwise the specified configuration will not be used, e.g.

    php -i -c /etc/php7/fpm/php.ini | grep "Loaded Configuration File"
    Loaded Configuration File => /etc/php7/cli/php.ini
    
    php -c /etc/php7/fpm/php.ini -i | grep "Loaded Configuration File"
    Loaded Configuration File => /etc/php7/fpm/php.ini

This is because -i and -m will immediately execute instead of processing and config flags:

https://github.com/php/php-src/blob/2349332b664887474ed2fb09dcdc4c57d8bb2b85/sapi/cli/php_cli.c#L679-L738



Test script:
---------------
Run from shell:

    php -i -c /etc/php/7.0/fpm/php.ini | grep "Loaded Configuration File"


Expected result:
----------------
Loaded Configuration File: /etc/php/7.0/fpm/php.ini


Actual result:
--------------
Loaded Configuration File => /etc/php/7.0/cli/php.ini

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-08-08 10:02 UTC] gooh@php.net
This also affects the CGI SAPI. It does not affect FPM.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 10:01:30 2024 UTC