PDA

View Full Version : php.ini & mod_rewrite


TiMoGo
02-07-2006, 22:00/10:00PM
My current web host says that I can modify a file called php.ini to turn on the mod_rewrite function. They say it is loaded, but not turned on globally on the server. (My understanding is this file allows changes for my website only to server conditions set by another file that I am unable to access).

However, they say that telling me how to modify the file is scripting support and they do not do that.

I have searched on the internet and can only find things specific to a certain program and can't find enough of a pattern to just guess.

Does anyone know what I should be adding to this file to get mod_rewrite to work?

I think I can fumble through the rest of the mod_rewrite if I can at least get it turned on. Any suggestions would be appreciated!

Comeran
02-07-2006, 22:06/10:06PM
Is this your own server, or a dedicated server?

The php.ini file does not enable or disable mod_rewrite, that is controlled from your apache config file.

Comeran-

TiMoGo
02-07-2006, 22:24/10:24PM
It is a shared hosting server. They say that it is set up in a file called httpd.conf, but that it is turned off. And that I have to use the php.ini file to enable it for my website.

Honestly, that is really all I know. I am not happy with my hosting provider, but financially am not able to change right now since I have dumped all of my start-up money into other things. (Including a huge check to them!) I am also thinking that I may buy my own server within a couple of months and don't want too many changes right in a row.

Comeran
02-07-2006, 22:35/10:35PM
Tim,

I don't know if you need your own server since it will only leave more of these things to you. I think even a shared host would be just fine as long as you get the support you need.

I have never heard of mod_rewrite requiring anything in the php.ini file. They could mean that you can use mod_rewrite by editing your httpd.conf file or that you can use the php re-write by enabling url_rewriter.tags in your php.ini file.

I really only know our servers and how we operate here but they should be able to just turn on mod-rewrite for you from your httpd.conf file so all you have to do is start writing your rules in your .htaccess file.

Comeran-

WebSavvy
02-07-2006, 23:04/11:04PM
I have it turned off on my server too (as my default) and then any domains wanting to use mod_rewrite just need to add the following lines at the top of their .htaccess file in the domain root:

Options +FollowSymlinks
RewriteEngine On
RewriteBase /

Try that, and see if it works for you?

Connie
02-07-2006, 23:13/11:13PM
Frankly I know little about this. I do know that my web host recently switched from php_mod to php_cgi. Anyone who had php flags (whatever that means had to put those in a php.ini file.

That did not disable all .htaccess in regard to php, but did certain functions which now have to be in the ini file.

Yes this is on shared hosting.

WebSavvy
02-07-2006, 23:30/11:30PM
They're probably running php suEXEC which causes php to run as a cgi module Vs an Apache module.

When being ran as a CGI module, the php.ini file must be used in order to use certain functions within php enviornment.

I don't have php running that way on my current server, but at my old webhost -- it was.

Lots of people that had improperly coded php scripts, had problems immediately. I didn't because mine were always coded properly.

One of the things you'll need to do if on a server with php suEXEC running, is all php open and close tags must be proper:

<?php

?>
= proper

<?

?>
= improper

Also, you have to use the full root path (for includes) hard coded Vs variable for server path.

Means using this:
@include("/home/user/path/to/file.php");

Vs using this:
@include("{$_SERVER['DOCUMENT_ROOT']}/to/file.php");

g1smd
03-07-2006, 15:50/03:50PM
Locate the file you are supposed to edit, download it via FTP to your local machine, and look at it in a standard text editor.

Those files usually have a load of comments that explain exactly what every line in the file is supposed to do.