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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: gooh@php.net
New email:
PHP Version: OS:

 

 [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

Pull Requests

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: Thu Nov 21 14:01:29 2024 UTC