Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Php.ini ignored


Reply


3 Posts   645 Views

Avatar
paradigm

Community Member, 5 Posts

26 November 2011 at 10:00pm

Hi,

when I access a page without mod_rewrite (e.g. "/index.php/about-us") the correct php.ini - in the root of the Silverstripe site - is loaded and enough memory is allowed for the site to run. However if I just access "/about-us" the default php.ini for the hosting account is read and the site will error with a memory exhausted fatal error.

I am using a shared web host (CPanel) and am at a complete loss as to why it would be loaded in all cases except when using mod_rewrite.

Has anyone encountered this issue and found a workaround for it?

Thanks,
David.

Avatar
simon_w

Forum Moderator, 474 Posts

26 November 2011 at 11:26pm

From [url]http://php.net/manual/en/configuration.file.per-user.php[/url]:
In addition to the main php.ini file, PHP scans for INI files in each directory, starting with the directory of the requested PHP file, and working its way up to the current document root (as set in $_SERVER['DOCUMENT_ROOT']). In case the PHP file is outside the document root, only its directory is scanned.

In many shared hosting environments, this is the case. As the mod_rewrite rules handle the request to sapphire/main.php, PHP will only look for a user ini file in sapphire.

Avatar
paradigm

Community Member, 5 Posts

26 November 2011 at 11:34pm

Thank you Simon for your solution, it worked perfectly.

-David.