By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,829 Members | 2,308 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,829 IT Pros & Developers. It's quick & easy.

Run PHP scripts outside of the web directory

P: n/a
Hello,
Is it possible to run a script that will be used from all the websites
on the server outside of the web dir ?
At the moment for every site I have I upload the script in the web dir
of the specific site...

Specifically it is a RichEditor so it has javascripts as well ...
But it is difficult to maintain updates of the script to all websites
so I would prefer if I had only one place to update it...

Any ideas will be appreciated.

Angelos.

Feb 13 '07 #1
Share this Question
Share on Google+
6 Replies


P: n/a
"Aggelos" asked...
: Is it possible to run a script that will be used from all the
: websites on the server outside of the web dir ?

If the server is a Windows server, take a look at these
two commands inside a cmd.exe prompt...

help ftype
help assoc

The goal involves placing php.exe into the path and then
associating the required php extensions to a common file
type.

If PHP is installed upon a Unix/Linux server, someone else
might be able help there.

--
Jim Carlock
Post replies to the group.
Feb 13 '07 #2

P: n/a
If the server is a Windows server, take a look at these
two commands inside a cmd.exe prompt...
Nope it is Unix. :(

Thanks

Feb 13 '07 #3

P: n/a


Aggelos wrote:
Hello,
Is it possible to run a script that will be used from all the websites
on the server outside of the web dir ?
At the moment for every site I have I upload the script in the web dir
of the specific site...

Specifically it is a RichEditor so it has javascripts as well ...
But it is difficult to maintain updates of the script to all websites
so I would prefer if I had only one place to update it...

Any ideas will be appreciated.
As it contains javascript, I understand that it has to be
browser-accessible. In that case, and since you are running unix, I
think a symbolic link is the easiest way.

Another approach is to share the directory in a source code control
system (subversion, for instance), but this will result in physical
multiple copies.

Best regards
--
Willem Bogaerts

Application smith
Kratz B.V.
http://www.kratz.nl/
Feb 13 '07 #4

P: n/a
Aggelos wrote:
Is it possible to run a script that will be used from all the websites
on the server outside of the web dir ?
I'm not 100% sure what you're asking for, but it sounds to me like
symbolic links might be the answer.

Say you have three sites hosted on a server, example.com, example.org
and... you guessed it... example.net. These are hosted in the following
directories on the server:

/var/www/vhosts/example.com/
/var/www/vhosts/example.org/
/var/www/vhosts/example.net/

Now, you install some flashy-super-web-based-app into, say:

/var/www/apps/FSWBA/

and you want to make this available as:

http://example.com/FSWBA/
http://example.org/flashy/
http://example.net/flashy-app/

Then all you need to do is create three symbolic links, using the
following commands at the command line:

ln -s /var/www/apps/FSWBA/ /var/www/vhosts/example.com/FSWBA/
ln -s /var/www/apps/FSWBA/ /var/www/vhosts/example.org/flashy/
ln -s /var/www/apps/FSWBA/ /var/www/vhosts/example.net/flashy-app/

And you're done. (Note: you may need to configure Apache to be able to
follow symbolic links, as this ability is often disabled for security
reasons.)

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
Feb 13 '07 #5

P: n/a
On Feb 13, 3:58 pm, Toby A Inkster <usenet200...@tobyinkster.co.uk>
wrote:
Aggelos wrote:
Is it possible to run a script that will be used from all the websites
on the server outside of the web dir ?

I'm not 100% sure what you're asking for, but it sounds to me like
symbolic links might be the answer.
I'll try symbolic links then.
I haven't thought that and I believe is the best sollution.

Feb 13 '07 #6

P: n/a

"Aggelos" <dj*****@gmail.comwrote in message
news:11*********************@a34g2000cwb.googlegro ups.com...
Hello,
Is it possible to run a script that will be used from all the websites
on the server outside of the web dir ?
At the moment for every site I have I upload the script in the web dir
of the specific site...

Specifically it is a RichEditor so it has javascripts as well ...
But it is difficult to maintain updates of the script to all websites
so I would prefer if I had only one place to update it...

Any ideas will be appreciated.

Angelos.

I'm sure the other idea about symbolic links is fine, but couldn't you just
put a small "shell" php file with something like

<?php

include ("/path/to/the/real/script");

?>

anywhere you'd like to use the script? This way you change the script in one
place and the includes in the shell file will reflect that in any
application which uses it.

I'm just saying that as you'd be able to avoid having to make symbolic links
for every new app that uses your script.

Denis Gerina
Feb 13 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.