I have 2 Macs whose general configuration I want to keep sync'd. For Apache and PHP, I store the conf files (httpd.conf and php.ini, respectively) in my Dropbox (~/Dropbox/config
) and use symlinks to reference the shared from from the expected location.
Similarly, I share a couple of code bases in the same way. The physical files are located in ~/Dropbox/Development
and linked to from ~/Development/
. Now I need to share a library of utility classes and I can't figure out how to do that. The problem is that every directory in play sits within my home directory and my username is different on each machine. On one, it's ~/rwilkerson
and it's ~/rob
on the other.
How can I get my php.ini to resolve this? In my httpd.conf, I've done so by using environmental variables. For example, in a virtual host config file, I can set my web root to /Users/${SUDO_USER}/path/to/webroot
. Since I use sudo to restart Apache (sudo apachectl restart
), the environment variable evaluates to the proper username on whichever machine I'm on.
As far as I can tell, I can't use variables in my php.ini in a similar way. I thought that if I simply included both paths in my include_path
, PHP would simply ignore the one that doesn't exist on a given machine, but that doesn't appear to be the case. My shared libraries will only be included if the correct path appears before the incorrect path.
I can't find any resource that spells out the nuances of how the include_path
directive works, so I can't find any way around this apparent limitation. Anyone have any ideas?
Thanks.
Answer:
I ended up using StasM's solution #1 below. In my httpd.conf file (also shared), I added:
php_value include_path "/opt/local/lib/php:${HOME}/Dropbox/Development/lib/php/classes"
Doing that overrode any value in php.ini
and worked beautifully.