Welcome! Log In Create A New Profile

Advanced

Load custom php.ini on shared server

Posted by dimaggio 
Load custom php.ini on shared server
January 26, 2010 07:30AM
Hey,

I recently switched to use nginx on my VPS over at Dreamhost (everything is so much faster!).
I've manage to configure everything except how to use custom php.ini files

In apache i could call this in my .htacces
[code]
Options +ExecCGI
AddHandler php-cgi .php
Action php-cgi /cgi-bin/php-wrapper.fcgi
[/code]

and the php-wrapper.fcgi executed php5.cgi with my custom ini
[code]
#!/bin/sh
exec /dh/cgi-system/php5.cgi $*
[/code]

Is this possible to make in nginx?

Thanks,
Simon.
Re: Load custom php.ini on shared server
January 31, 2010 04:21PM
Can nobody help? Give any suggestions where i can look for the answer?
Guess i'll have to switch back to slowish apache.
Re: Load custom php.ini on shared server
February 01, 2010 02:29AM
Hi Simon,

Did you compile that php5.cgi for yourself, or is that something provided by DreamHost? I've only recently started working with nginx myself but I think I see where you are going. If you can compile your own, and I understand what you want to do, then you should look at patching php with something called php-fpm before you compile it. That adds fastcgi support and makes it so you can proxy from nginx to your custom version of PHP (which has it's own php.ini file) (search for "fastcgi_pass" to see examples.) If you need more than one customized version of PHP, you can have them running on different IPs and/or ports. If your VPS doesn't let you listen to other ports, then you might try putting each version of PHP on its own sub-domain, and proxy it that way.

Hope that helps,
Jon
Re: Load custom php.ini on shared server
February 05, 2010 03:33AM
Thanks for the response, though dh updated their wiki with the solution: copy the shared php.ini to ${HOME}/.php-ini
Works great.

(Remember to restart your webserver and php though)
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 308
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready