How do you specify the path of the php.ini file for a PHPStorm project to use?

I have been trying to tell PHPStorm what php.ini file to use when running my project and I cannot.

PhpInfo reports that:

Configuration File (php.ini) Path C:\Windows
Loaded Configuration File (none)
Scan this dir for additional .ini files (none)
Additional .ini files parsed (none)

however, I have specified that the path should be C:\PHP\php-5.6.7\php.ini by setting the "interpreter options" of the "run configuration":

--php-ini C:\PHP\php-5.6.7\php.ini

According to this thread, this is how to do it, but it suggests that there might be a different system in recent versions of PHPStorm. I am not able to discover what that system is.

Comment actions Permalink

Hi there,

--php-ini C:\PHP\php-5.6.7\php.ini

No idea why it does not work for you.

In any case: "-c" works just fine (just tested on php 5.6.7 running on Windows 7)


Ignore the small path difference -- it's because "E:\Projects\php\" is a symlink to "E:\Projects\php56\"

Comment actions Permalink

--php-ini C:\PHP\php-5.6.7\php.ini works for you? If so, what version of PHPStorm do you have? I am on 8.0.3

switching it to -c C:\PHP\php-5.6.7\php.ini worked for me, but that just leavs me more confused about what is actually going on here.

Comment actions Permalink
--php-ini C:\PHP\php-5.6.7\php.ini works for you?

Have not tried then.

I've double checked manual as well as ouput of "php -h" which shows modern options ("--php-ini" is a long option name for "-c") and just used them.

But I've just check it in console (not via PhpStorm) and it worked as well (notice the order of parameters):

>php --php-ini "E:\Projects\php\php-alt.ini" -i
PHP Version => 5.6.7

System => Windows NT 6.1 build 7601 (Windows 7 Enterprise Edition Service Pack 1) i586
Build Date => Mar 19 2015 15:03:29
Compiler => MSVC11 (Visual C++ 2012)
Architecture => x86
Configure Command => cscript /nologo configure.js  "--enable-snapshot-build" "--enable-debug-pack" "--disable-zts" "--disable-isapi" "--disable-nsapi"
"--without-mssql" "--without-pdo-mssql" "--without-pi3web" "--with-pdo-oci=c:\php-sdk\oracle\x86\instantclient_12_1\sdk,shared" "--with-oci8-12c=c:\p
hp-sdk\oracle\x86\instantclient_12_1\sdk,shared" "--with-enchant=shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet=shared" "--with-mcrypt
=static" "--without-analyzer" "--with-pgo"
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => C:\Windows
Loaded Configuration File => E:\Projects\php56\php-alt.ini
Scan this dir for additional .ini files => (none)
Additional .ini files parsed => (none)
PHP API => 20131106
PHP Extension => 20131226
Zend Extension => 220131226
Zend Extension Build => API220131226,NTS,VC11
PHP Extension Build => API20131226,NTS,VC11
Debug Build => no
Thread Safety => disabled
Zend Signal Handling => disabled
Zend Memory Manager => enabled
Zend Multibyte Support => provided by mbstring
IPv6 Support => enabled
DTrace Support => disabled

Registered PHP Streams => php, file, glob, data, http, ftp, zip, compress.zlib, compress.bzip2, https, ftps, phar, sqlsrv
Registered Stream Socket Transports => tcp, udp, ssl, sslv3, sslv2, tls, tlsv1.0, tlsv1.1, tlsv1.2
Registered Stream Filters => convert.iconv.*, mcrypt.*, mdecrypt.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consum
ed, dechunk, zlib.*, bzip2.*

This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies
    with Xdebug v2.3.2, Copyright (c) 2002-2015, by Derick Rethans

Please sign in to leave a comment.