It's possible in apache's configuration httpd.conf
to set up .htaccess
so that it is named something different, using the AccessFileName .htaccess
directive.
Is there any way to set up PHP so it looks for the php.ini
file under a different name? (I'm not trying to symlink - thanks)
Update
For those of you who are curious about why I would want to do such a thing:
I would be looking at changing the name of the file on the development machine, not the production machine. I've already set up a different .htaccess name on my local machine and it's been great. I can rsync between remote and local and keep different copies of both files on each machine, and yet only the proper file has effect. I can then diff the two files locally, which is nice.
These files both have more to do with the web sever configuration, and less to do with the web applications. Perhaps it is important to set up different include paths, or other such variables which are server specific. That sort of thing. Ideally your development server is a duplicate of the production server, but if you work on several different remote servers, especially with shared hosting, this is the kind of thing which is really convenient.
So basically having a different config file name for these local files and the remote files just allows keeping both copies side by side.
You could setup a symbolic link
It looks like the answer is "maybe"
PHP CLI has an arg, "-c", that lets you specify the path in which to search for the php.ini file, or the full path to the file itself.
PHP run as an Apache module has only directives to specify the path in which to search for the file, not the name of the file itself.
Finally, using a symlink as suggested will only work for the CLI version of PHP. A symlink to a directory in which to search for php.ini may work, but a symlink to the file will only work if the name of the symlink is "php.ini" which is not quite what your question asked to accomplish.
References
http://www.php.net/manual/en/configuration.file.php
The question from me is, "Why?" Why would you want to do this? I have a few instances of configuring services where at the time, I changed the name the configuration file to something related to the company or group or product or whatever that I was supporting with the service. i.e., Something different from the default. In pretty much all of those cases I've learned the hard way that doing so was a bad idea, from the point of view of maintainability, manageability, supportability, handoff to colleagues, etc.
I think you are searching for
---exclude=php.ini --exclude=.htaccess
switches of rsync. If you sync with script, add these two switches to it and rsync willn't copy these files anymore.Anyway, I do not think renaming php.ini (even if it is possible) is a good idea. Do not do it.
The name
.htaccess
can be changed inhttpd.conf
orapache2.conf
. And for php.ini, that may be buried in some apache include or in somec
source itself. Would it be enough to symlink it?