auto_prepend_file per dir

11 posts / 0 new
Last post
#1 Thu, 02/07/2013 - 12:11
eddieb

auto_prepend_file per dir

On Webmin 1.610, Virtualmin 3.98.gpl, Apache/2.2.15 (CentOS 6.3) mod_fcgid/2.3.7, I need to set a different auto_prepend_file specific to a subdirectory of a virtual host.

Is this possible?

Sat, 01/25/2014 - 01:08
tpnsolutions
tpnsolutions's picture

Hi,

Could you please expand on what you're trying to do a bit more, thanks :-)

Best Regards,
Peter Knowles
TPN Solutions

E: pknowles@tpnsolutions.com
P: 604-782-9342
W: http://www.tpnsolutions.com
Best Regards,
Peter Knowles | TPN Solutions
Email: pknowles@tpnsolutions.com | Skype: tpnassist
Wed, 02/13/2013 - 11:13
eddieb

You can't have per dir php.ini or user.ini in mod_fcgid, hence the need to use a prepended file.

Thanks

Wed, 02/13/2013 - 11:48
tpnsolutions
tpnsolutions's picture

Hi,

Why would you need a "per directory" configuration file? Could you elaborate on what your needs are, so we can help put together a potential solution.

Best Regards,
Peter Knowles
TPN Solutions

E: pknowles@tpnsolutions.com
P: 604-782-9342
W: http://www.tpnsolutions.com
Best Regards,
Peter Knowles | TPN Solutions
Email: pknowles@tpnsolutions.com | Skype: tpnassist
Wed, 02/13/2013 - 12:00
eddieb

As per the OP, I need to set a different auto_prepend_file specific to a subdirectory of a virtual host. The prepended file sets newrelic_set_appname. When using mod_fcgi, there is no other way around it, besides modifying off the shelf app code (magento and WP in my case).

Wed, 02/13/2013 - 12:07
tpnsolutions
tpnsolutions's picture

Hi,

Recommended reading, which may solve your problem.

http://php.net/manual/en/configuration.file.per-user.php

Best Regards,
Peter Knowles
TPN Solutions

E: pknowles@tpnsolutions.com
P: 604-782-9342
W: http://www.tpnsolutions.com
Best Regards,
Peter Knowles | TPN Solutions
Email: pknowles@tpnsolutions.com | Skype: tpnassist
Wed, 02/13/2013 - 16:04
eddieb

user.ini is only read when using CGI or FastCGI, which, again, is not my case.

Thu, 02/14/2013 - 09:24
tpnsolutions
tpnsolutions's picture

Hi,

You could try the solution found in answer #3 at:

http://stackoverflow.com/questions/4248140/how-to-set-phps-auto-prepend-...

*** Keep in mind, Virtualmin is not designed to break the way a feature of PHP is built, so the above solution may be the only way to accomplish the task if you're not using either "CGI" or "FCGI" setup as noted in the former solution. ***

Best Regards,
Peter Knowles
TPN Solutions

E: pknowles@tpnsolutions.com
P: 604-782-9342
W: http://www.tpnsolutions.com
Best Regards,
Peter Knowles | TPN Solutions
Email: pknowles@tpnsolutions.com | Skype: tpnassist
Thu, 02/14/2013 - 09:51
eddieb

I am using neither CGI or FCGI (FastCGI). I am using mod_fcgid. Also, grabbing the output of an entire script and placing it in a buffer is a resource intensive operation. No can do, but thanks.

Thu, 02/14/2013 - 10:00
tpnsolutions
tpnsolutions's picture

Hi,

Like I said, the above solution is a work around, and personal I don't feel it's nearly as ideal as using either "CGI" or "FCGI" which supports the per directory functionality you are seeking.

Since neither of the solutions are to your liking, I'd recommend writing to the PHP team directly and ask for this feature to be made available, as this is something that Virtualmin will not be able to accomplish for you given it's not a Virtualmin issue, but rather a native PHP issue itself.

You can get support for PHP matters by visiting:

http://php.net/support.php

Best Regards,
Peter Knowles
TPN Solutions

E: pknowles@tpnsolutions.com
P: 604-782-9342
W: http://www.tpnsolutions.com
Best Regards,
Peter Knowles | TPN Solutions
Email: pknowles@tpnsolutions.com | Skype: tpnassist
Thu, 02/14/2013 - 12:52
eddieb

I don't even think this is an issue with PHP, but an issue with how PHP is handled by Apache.

Regardless, I was looking for options. One of them is to use the htaccess scanner module: http://pecl.php.net/package/htscanner

The other is to build in the needed per dir directives into the logic of the single prepended php file, which is what I opted to do since it is the option that requires the least modification to Virtualmin.

Thanks Peter!

Topic locked