Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable disabling of loading defaults php.ini. #290

Closed
hrach opened this issue Feb 22, 2016 · 11 comments
Closed

Disable disabling of loading defaults php.ini. #290

hrach opened this issue Feb 22, 2016 · 11 comments
Milestone

Comments

@hrach
Copy link

hrach commented Feb 22, 2016

The current approach is quite obvious - tests should be indenpendent of your current development settings/environment.

However, in the context of docker, containers etc. it complicates things. You have to specifiy the php dependencies & configuration in Dockerfile. Then you have to either wire you tests to dockers' php.ini and tight it up with the php version in the path (/etc/php7.0/php.ini) , or you have to redefine you php.ini settings once again.

The most elegant solution would be an option do disable the -n. What do you think?

@milo
Copy link
Member

milo commented Feb 22, 2016

The -n has to be default. Otherwise it complicates running tests under different PHP versions on the same machine (on the Windows it is extremly annoing with dosens of error pop-ups).

Time to time, as users open issues, I'm thinking about option to disable it. Because the environment can be prepared for testing purpose only (e.g. your Docker).

@hrach
Copy link
Author

hrach commented Feb 22, 2016

Yeah, as you have tagged, it's "friendliness", something like
php vendor/bin/tester c $(php -r "echo php_ini_loaded_file();") will (added)partially(/added) solve it for now.

@JanJakes
Copy link

Actually -c does not load extension configs fron conf.d:

php -n -c $(php -r "echo php_ini_loaded_file();") --ini

Configuration File (php.ini) Path: /usr/local/etc/php/7.0
Loaded Configuration File:         /usr/local/etc/php/7.0/php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)

@JanJakes
Copy link

I've found a workaround using a nasty hack:

cat $(php -r 'echo php_ini_loaded_file() . " " . str_replace("\n", " ", str_replace(",", "", php_ini_scanned_files()));') > php-tests.ini

php $dir/../vendor/bin/tester -p php -c php-tests.ini $@

It would be definitely nice not to have to do that :)

@fmasa
Copy link

fmasa commented Apr 18, 2016

In time of CI tools, containers and VMs used for development the reason behind disabling default php.ini gets weaker.

What if the current scenario was replaced with -n flag in tester itself?

Run tests with default php.ini

vendor/bin/tester tests

Run tests without php.ini

vendor/bin/tester tests -n

Run tests with /my/php.ini

vendor/bin/tester tests -c /my/php.ini

@milo
Copy link
Member

milo commented Apr 18, 2016

As I wrote above, the -n has to be a default behavior. Otherwise it is unpredictable.

I'm plannig to open PR with support "running without -n". In meantime thinking how to name the new option. --keep-default-ini?

@dg
Copy link
Member

dg commented Apr 18, 2016

What about reuse -c, something like -c default. Just idea.

@milo
Copy link
Member

milo commented May 18, 2016

I just found that PHP allows you to load additional *.ini files in runtime by env var PHP_INI_SCAN_DIR. Anyway, it is not applied with -n.

New fact in a game :)

@fmasa
Copy link

fmasa commented Jun 5, 2016

What about -c flag with no aditional argument?

vendor/bin/tester tests # Run without php.ini
vendor/bin/tester tests -c # Run with default *.ini
vendor/bin/tester tests -c my-php.ini # Run with specific *.ini

@milo
Copy link
Member

milo commented Jun 6, 2016

@fmasa Setting (adding) own php.ini should work even with default system INI. I'm thinking about -C.

@fmasa
Copy link

fmasa commented Jun 6, 2016

@milo I see. +1 for -C

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants