SLUG Mailing List Archives
Re: [SLUG] Symlinks and PHP4
- To: Matthew Palmer <mpalmer@xxxxxxxxxxx>
- Subject: Re: [SLUG] Symlinks and PHP4
- From: O Plameras <oscarp@xxxxxxxxxxx>
- Date: Thu, 02 Sep 2004 20:26:37 +1000
- Cc: slug@xxxxxxxxxxx
- User-agent: Mozilla Thunderbird 0.7.3 (X11/20040803)
Matthew Palmer wrote:
On Thu, Sep 02, 2004 at 07:08:20PM +1000, O Plameras wrote:
Matthew Davidson wrote:
Here's a really elementary question about symlinks that's taxing my
limited mental capacity:
I want to write some php apps to be made available to a number of
virtual hosts on a web server. It seems to me that you should be able
to put the apps themselves somewhere outside the web root, for
instance '/usr/share/phpapp', and have a symlink from the virtual
hosts web root, i.e.:
/var/www/host.domain.tld/phpapp => /usr/share/phpapp
You rename directories for httpd access using the 'Alias Directory'
command. Renaming with 'ln -s' does not work.
This is the specific command that one use in 'httpd.conf'
Alias /phpapp/ /usr/share/phpapp/
deny from all
But that's not a web thing, it's just that symlinks are often followed
to their end before applying the '..', so you go to the place you didn't
But there is a conventional way to access PHP modules or include
files. This is done by declaring the directory from where to get the PHP
scripts to be included in your /etc/php.ini. Look for a line that says,
Or, better still, use
ini_set('include_path', '.:/usr/share/php:/usr/share/phpapp'); at the top of
your entry point, and all will be well. Fiddling with include_path in
php.ini shouldn't be done for one application -- imagine if I wanted to
include something that also happened to be in /usr/share/phpapp... A train
wreck could result.
Programmers have their styles. I follow PHP programming conventions
that I know works and practised by many.
include_path = "/path1;,/path2; etc.............."
It will look like so,
include_path = ".;/usr/share/phpapp"
Those should be colons, not semi-colons, unless you're running PHP in
windows, in which case you've got bigger problems (like not having real
In /etc/php.ini the correct syntax is semi-colon ( ; ) and not colon (:).