Go Back   HostGator Peer Support Forums > HostGator Peer Support Forums > Shared Hosting Support

Notices

Reply
 
Thread Tools
  #1  
Old 06-04-2007, 12:20 PM
jpck jpck is offline
Hatchling Croc
 
Join Date: May 2007
Posts: 5
Angry Issue using custom php.ini config file, can hostgator help to solve the issue ?

Hi

Background: I open a shared hosting (baby size) 1 week ago and HostGator seems to be a great host so far Great performances, ssh access, php5 and rails support. All good Except one point, the following problem (see above). I already discuss with support (ticket FHU-962734) but they said after discussion they can't help.

Website description: I'm using a MVC layout created in PHP5. I have an index.php file on the website who take the requests and process the right page to the user depending on that request. The index.php parse the url to find what page is requested and what are the parameters. An example will be an url like http://mywebsite/index.php/somepage/foo/bar making index.php loading the page "somepage" with parameters "foo" and "bar". This is a classic pattern to use. I'm after that hiding the index.php with some apache rewriting.

Problem description: in some circumstances, the PHP5 wrapper script on the HostGator server won't load my php.ini configuration. Speaking with the support, it appears that HostGator use a PHP5 wrapper script that find the current script path and look into it to find a php.ini file. To find the directory, they use the environment variable PATH_TRANSLATED. After some research it appears that, that variable doesn't always return the current script path. See urls :
http://www.php.net/manual/en/migrati...compatible.php
http://www.php.net/manual/en/reserve...riables.server
http://www.zend.com/lists/php-dev/200305/msg00521.html
In the case a website use urls like I do, the PATH_TRANSLATED will contains the end of the url, in my example, /somepage/foo/bar. In that case, the wrapper script will assume the directory of the script is /somepage/foo, directory that doesn't exist on the server (nobody with a shared account can write on / anyway). So on my website, my custom php.ini is never loaded except when I'm on the index page, without any parameters (http://mywebsite/index.php).

Possible solutions :
A - HostGator to modify the PHP5 wrapper script to use SCRIPT_FILENAME instead if PATH_TRANSLATED. SCRIPT_FILENAME returns always the location of the script as expected.
B - Modify my websites to not use that url pattern and use GET instead, it's not a really good one, I don't want to modify different websites I have (they all use the same framework) and I don't want to add more url rewritting
C - Changing host ? I'd like to stay at HostGator, as I said, they are a good host I think.
D - Move to dedicated (suggested by kmaw), but I don't have the budget right now
E - Rewriting tricks I just found (see below)
F - Do someone see another solution ?

I'm wondering if other customer had this problem here ?

Last edited by jpck; 06-04-2007 at 01:31 PM.
Reply With Quote
  #2  
Old 06-04-2007, 12:25 PM
kmaw's Avatar
kmaw kmaw is offline
Emperor Croc
 
Join Date: Mar 2005
Location: Ontario, Canada
Posts: 1,924
Default Re: Issue using custom php.ini config file, can hostgator help to solve the issue ?

....or move to dedicated
Reply With Quote
  #3  
Old 06-04-2007, 12:33 PM
jpck jpck is offline
Hatchling Croc
 
Join Date: May 2007
Posts: 5
Default Re: Issue using custom php.ini config file, can hostgator help to solve the issue ?

I unfortunally don't have the budget right now. But it's true, I worked with dedicated before, and it's great I'm adding your comment to my original post.
Reply With Quote
  #4  
Old 06-04-2007, 01:29 PM
jpck jpck is offline
Hatchling Croc
 
Join Date: May 2007
Posts: 5
Default Re: Issue using custom php.ini config file, can hostgator help to solve the issue ?

I just found a good way to fix the problem, but I still liked if HostGator staff, can look at their wrapper because I think it would be better to use SCRIPT_FILENAME to get the script directory.

My solution is to rewrite my entire url to index.php and do not include the parameters in the rewrite.

Before I was doing a rewrite from http://mywebsite/some-keyword/some-page/foo/bar to http://mywebsite/index.php/some-page/foo/bar

Now I do http://mywebsite/some-keyword/some-page/foo/bar to http://mywebsite/index.php

The PATH TRANSLATED this way make the wrapper points to the correct php.ini while the variable REQUEST_URI still has the original address and this way, my MVC work.
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -5. The time now is 09:30 AM.