Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationApache Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old February 12th, 2001, 01:31 PM
experienceparadise experienceparadise is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Posts: 5 experienceparadise User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Any ideas on how to make all files called from a certain directory, call a single file.

e.g all files in local directory call file called local?

Thanks
Barrie

Reply With Quote
  #2  
Old February 12th, 2001, 03:01 PM
oskar oskar is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2000
Location: Copenhagen, DK
Posts: 222 oskar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 50 m 40 sec
Reputation Power: 8
Send a message via ICQ to oskar
<?
// following is a part of http://www.zend.com/zend/tut/photogallery.php, modified to my own needs

// directory path
$filepath = "../nasa";

// get unique server directory used for this user session
$dir = dir($filepath);

// loop through all server subdirectories for this user session
while($entry=$dir->read()) {

// if entry is system file (doesn't have picture files), go to next entry in
// "while" loop
if($entry == "." || $entry == "..")
continue;

// if there is an error, go to next entry in "while" loop
$fp = fopen("$filepath/$entry","r");
if(!$fp) {
print "Bad entry: $entry<br>";
continue;
}
fclose($fp);

?>

<a href="../nasa/<? echo $entry ?>"><? echo $entry ?></a><br>

<?
}
?>

Could this be usefull?
Steffen

Reply With Quote
  #3  
Old February 12th, 2001, 03:22 PM
experienceparadise experienceparadise is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Posts: 5 experienceparadise User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks oskar...

Would it work with the following in the httpd.conf file?
<location /local>
ForceType application/x-httpd-php
</location>

Reply With Quote
  #4  
Old February 12th, 2001, 03:32 PM
oskar oskar is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2000
Location: Copenhagen, DK
Posts: 222 oskar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 50 m 40 sec
Reputation Power: 8
Send a message via ICQ to oskar
Well, I'm using win95 with my apache.
(Yeahh, I know, but I have to use my photoshop and flash to create websites)
You will have to download the latest php-version: http://www.php.net
Find the php-version that fits your platform.

My apache conf-file looks like:

ScriptAlias /php/ c:/apache/php/
AddType application/x-httpd-php .php
Addhandler application/x-httpd-php .php
Action application/x-httpd-php /php/php.exe

Steffen

Reply With Quote
  #5  
Old February 12th, 2001, 04:05 PM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>> <location /local>
>> ForceType application/x-httpd-php
>> </location>

This tells Apache to force any request to your /local directory to be executed as PHP, it doesn't force them to execute /local/local at all.

Why don't you use mod_rewrite?

<Directory /server/path/to/local>
RewriteEngine on
RewriteRule ^(.*) local [T=application/x-httpd-php]
</Directory>

You can find more examples if you search RewriteRule under my username in Apache forum. Try this particular one -> http://forums.devshed.com/showthread.php?threadid=9203

Reply With Quote
  #6  
Old February 13th, 2001, 01:33 PM
experienceparadise experienceparadise is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Posts: 5 experienceparadise User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks for the advice on mod_rewrite.....

Im trying to follow the article on
http://www.phpbuilder.com/columns/tim20000526.php3

and have set up the a file called local as in the article. Any advice on which is the best redirection technique to use .htaccess httpd.conf or access.conf would be much appreciated.

I have set up variables based upon the REQUEST_URI e.g. local/variable1/variable2 etc
and the script uses the variables to decide which database, country, reference etc. I would like therefore to be able to

1) Redirect everything from /local to local.php
2) To pass variable1 variable2 etc into local.php

Any help would be much appreciated, as my forte is with PHP and MYSQL, not perl.

Thanks
Barrie

Reply With Quote
  #7  
Old February 13th, 2001, 02:14 PM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
>> Any advice on which is the best redirection technique to use

I have no plan to check out the article on phpbuilder. Your webserver is Apache, executing a PHP script (as a module or standalone CGI) will do another call to Apache. If you can do certain task at the very first call level - httpd.conf, that is the fastest and most reliable way of doing. Second level is .htaccess, then whatever script (php in your case).
So why bother to put such load to Apache if you can do it at the very first level? Just put it in httpd.conf. If you want it to be more dynamic, do the 2nd level.

>> 1) Redirect everything from /local to local.php
>> 2) To pass variable1 variable2 etc into local.php

Check this thread again -> http://forums.devshed.com/showthread.php?threadid=9203

Keep in mind, you are asking for external redirection, but you should go for internal redirection.

Reply With Quote
  #8  
Old February 13th, 2001, 05:05 PM
rod k rod k is offline
Apprentice Deity
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jul 1999
Location: Niagara Falls (On the wrong side of the gorge)
Posts: 3,237 rod k User rank is Private First Class (20 - 50 Reputation Level)rod k User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 m 8 sec
Reputation Power: 13
Send a message via AIM to rod k
FreeBSD is correct, the best place to force the directive to parse /local as PHP is in httpd.conf.

If you root folder is /usr/local/apache/htdocs/ for domain http://www.domain1.com and you want http://www.domain1.com/local/whatever/might/be/here to run the local script just place the script called local in the /usr/local/apache/htdocs/ directory and place the ForceType directive in httpd.conf. If you don't have access to httpd.conf you can do it in .htaccess

Note: you will need to parse the URL in the script "local" to get anything that is passed behind it as this will not be parsed automagically for you by PHP, even a generic query string. Besides, putting a query string behind the URL defeats the purpose of this manuever.

Reply With Quote
  #9  
Old February 14th, 2001, 11:34 AM
experienceparadise experienceparadise is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Posts: 5 experienceparadise User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Rod or freebsd

Any chance of an ICQ number so that I could ask some quick questions?

Thanks
Barrie

Reply With Quote
  #10  
Old February 14th, 2001, 01:34 PM
rod k rod k is offline
Apprentice Deity
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Jul 1999
Location: Niagara Falls (On the wrong side of the gorge)
Posts: 3,237 rod k User rank is Private First Class (20 - 50 Reputation Level)rod k User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 m 8 sec
Reputation Power: 13
Send a message via AIM to rod k
If you want help with something you should post YOUR ICQ# rather than expect us to post ours in a public forum.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > Forcing a file for all requests in a directory


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway