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

mgd2 extension breaks PHP if one config file is not readable #89

Open
flack opened this issue Jul 21, 2012 · 3 comments
Open

mgd2 extension breaks PHP if one config file is not readable #89

flack opened this issue Jul 21, 2012 · 3 comments

Comments

@flack
Copy link
Member

flack commented Jul 21, 2012

Steps to reproduce:

  • run a script as root that created a new midgard2 configuration in /etc/midgard2/conf.d.
  • as normal user, run php -v from the command line

Expected Result:

  • output of the currently installed PHP version information

Actual Result:

PHP Warning:  Failed to read my_new_config config file. Permission denied in Unknown on line 0
PHP Warning:  [Midgard2 minit] Failed to initialize configs in Unknown on line 0
PHP Fatal error:  Unable to start midgard2 module in Unknown on line 0

I should add that the new config file is not even referenced in php.ini or anything. But mgd2 seems to check all files in the folder for some reason, and if one of them is not readable, you can't run any php code until you fix this

@piotras
Copy link
Member

piotras commented Jul 21, 2012

That is correct. Please make sure midgard.http is Off for cli. This "unclear" and implicit behavior is done to make it possible to read config files with root permission before the privileges are dropped.

@flack
Copy link
Member Author

flack commented Jul 21, 2012

What I don't understand is why config files have to be read in the first place? Wouldn't it be better to do a lazy lookup, i.e. search for the file only when read_config or something similar is called?

I can of course change the config, but this requires further customization, since in Ubuntu (and Debian, too, I think), the php conf.d is a symlink, so by default all sapis use the same midgard config. It's not such a big deal, but yet another customization you have to remember to do when installing a new midgard server

@piotras
Copy link
Member

piotras commented Jul 21, 2012

This is the nature of PHP. We have to register classes when module is loaded. read_config() to open connection is one thing, register classes is another one.

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

No branches or pull requests

2 participants