473,406 Members | 2,208 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

require("common/latest.php") across multiple websites

I've set up the following using an Alias in Apache...

Alias /phpdocs/ "C:/Apache/htdocs/common/docs/php/"
<Directory "C:/Apache/htdocs/common/docs/php">
Options Indexes FollowSymlinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

It works well for HTML, all sites have access to the information.
I want to extend that to PHP require() and include() functions,
however the following maps out to an incorrect folder. Okay,
that's fine. My questions include, does PHP provide something
that maps out to the Apache Alias directive?

The common folder currently sits up two folders (../..) to the
VirtualHost folders. I realize that possibly a PHP "include_path"
directive could work. So the next question, anyone know of
another way to accomplish this?

Thanks.

Jim Carlock
Post replies to the newsgroup.
Jan 20 '06 #1
5 3190
Jim Carlock wrote:
I've set up the following using an Alias in Apache...

Alias /phpdocs/ "C:/Apache/htdocs/common/docs/php/"
<Directory "C:/Apache/htdocs/common/docs/php">
Options Indexes FollowSymlinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

It works well for HTML, all sites have access to the information.
I want to extend that to PHP require() and include() functions,
however the following maps out to an incorrect folder. Okay,
that's fine. My questions include, does PHP provide something
that maps out to the Apache Alias directive?

The common folder currently sits up two folders (../..) to the
VirtualHost folders. I realize that possibly a PHP "include_path"
directive could work. So the next question, anyone know of
another way to accomplish this?

Thanks.

Jim Carlock
Post replies to the newsgroup.


Sorry, Jim, you can't. PHP doesn't go through Apache to access files;
rather it goes straight to the file system itself. include_path is the
only way to handle it.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Jan 20 '06 #2
Jim Carlock wrote:
I've set up the following using an Alias in Apache...

Alias /phpdocs/ "C:/Apache/htdocs/common/docs/php/"
<Directory "C:/Apache/htdocs/common/docs/php">
Options Indexes FollowSymlinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

It works well for HTML, all sites have access to the information.
I want to extend that to PHP require() and include() functions,
however the following maps out to an incorrect folder. Okay,
that's fine. My questions include, does PHP provide something
that maps out to the Apache Alias directive?


http://fi.php.net/apache-lookup-uri/

Jan 20 '06 #3
Jim Carlock asked:
Does PHP provide something that maps out to the Apache
Alias directive?
"Chung Leong" <ch***********@hotmail.com> answered: http://fi.php.net/apache-lookup-uri/


Thank you, Chung Leong. Excellent.

The apache_lookup_uri() works quite well. It even works when
a filename is supplied and appends the filename to the mapping.

Alias /news/ "C:/Apache/htdocs/common/news/"
<Directory "C:/Apache/htdocs/common/news">
Options Indexes FollowSymlinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

<?php
// -- START THIS WORKS
// The topic.htm is not part of the Apache Alias above,
// but apache_lookup_uri() works nicely and accepts it
// and returns it as part of the fully qualified pathname to
// the file.
//
$info = apache_lookup_uri('/news/latest.php');
// print_r($info);
$latesttopic = $info->filename;
require($latesttopic);
//
// -- END THIS WORKS
?>

What's it good for? It offers a great way to provide a common
source of news on multiple websites. I like it. Only one place
to change the news and all sites that display the content get the
update. Look out cbsnews and msnbc! <g>

Now... time to figure a way to provide a way for a subdomain
to access the parent domains include files... without using a php
include in httpd.conf... hmmm. I'm going to get back to figuring
out how to do this with Apache.

Thank you very much, Chung Leong.

Thanks to Jerry Stuckle as well for your time and attempt.

Hope this helps.

Jim Carlock
Post replies to the newsgroup.
Jan 21 '06 #4
Another question...

Using the following code,

<?php require("/common/latest.php"); ?>

Is there a way to detect which page "required" latest.php ?

For instance...

Domain1, homepage (domain1.com/index.php) and
(domain1.com/talks/php/index.php) both employ ...
<?php require("/common/latest.php"); ?>

Domain2, provides similar multiple pages accessing the same
content by requiring...
<?php require("/common/latest.php"); ?>

Is there a php function that detections the name of the calling
page? And is there another way to do this? I'm working with
something along the lines of...

<?php require("/common/latest.php?rp=domain1.com/index.php"); ?>

Any other suggestions or a PHP server variable to detect the
name of the caller (calling page)?

Thanks.

Jim Carlock
Post replies to the newsgroup.
Jan 26 '06 #5
Jim Carlock wrote:
Another question...

Using the following code,

<?php require("/common/latest.php"); ?>

Is there a way to detect which page "required" latest.php ?

For instance...

Domain1, homepage (domain1.com/index.php) and
(domain1.com/talks/php/index.php) both employ ...
<?php require("/common/latest.php"); ?>

Domain2, provides similar multiple pages accessing the same
content by requiring...
<?php require("/common/latest.php"); ?>

Is there a php function that detections the name of the calling
page? And is there another way to do this? I'm working with
something along the lines of...

<?php require("/common/latest.php?rp=domain1.com/index.php"); ?>

Any other suggestions or a PHP server variable to detect the
name of the caller (calling page)?

Thanks.

Jim Carlock
Post replies to the newsgroup.


Yes. See http://fi.php.net/debug-back-trace/ for details.

Jan 26 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Danny Anderson | last post by:
Hola, PHP folk! I have a php page that contains a self-processing form. The form holds search results. The search terms originally came from the previous page, but the user can repeatedly...
5
by: Phil Powell | last post by:
I'm sorry but I can't figure out how to explain this any better than this. In PHP we have a command "require()" that obtains a file and logically places it into another file. I cannot figure...
4
by: Mxsmanic | last post by:
The require() I'm using in a PHP script has stopped working after I moved from PHP4 and Apache 1.3.x to PHP5 and Apache 2.x. Now I get messages like this: Warning:...
15
by: Michael | last post by:
Guten Morgen, I am implementing a script that my client wants on their website. Within the script there are several "require" statements. Any time one of these "require" statements is...
11
by: David | last post by:
Comments on a program called PHP Page Generator? ( http://www.phppagegenerator.com) I received a email offer of $100 and the product appears to allow quick generation of code for SQL web...
31
by: Yeah | last post by:
Is it absolutely necessary to include "http://" in an A HREF hyperlink? Would it be wise to remove this from one's Links page, just to save code?
11
by: Kimmo Laine | last post by:
I'm flipping my wig here, people. I'm using classes and making each class a file. when I'm including dependet classess, I use require_once to avoid multiple declarations - yet they happen. I put...
5
by: lister | last post by:
Hi all, I have a fairly diverse range of data that I want to cache in the session rather than pulling it from the database on every page refresh. The problem is is that it seems that PHP...
3
by: mejpark | last post by:
Good afternoon PHPers, This morning I downloaded "PHP Users" from sourceforge to implement a user registration system. I followed the instructions in INSTALL.txt, and successfully configured...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.