|
#1
|
|||
|
|||
|
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. |
|
#2
|
||||
|
||||
|
....or move to dedicated
|
|
#3
|
|||
|
|||
|
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.
|
|
#4
|
|||
|
|||
|
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. |
![]() |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
|
|
All times are GMT -5. The time now is 09:30 AM.



Great performances, ssh access, php5 and rails support. All good 





