473,654 Members | 3,028 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_pa th"
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 3203
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_pa th"
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*******@attgl obal.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_u ri() 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_u ri() works nicely and accepts it
// and returns it as part of the fully qualified pathname to
// the file.
//
$info = apache_lookup_u ri('/news/latest.php');
// print_r($info);
$latesttopic = $info->filename;
require($latest topic);
//
// -- 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=d omain1.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=d omain1.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
3132
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 refine the results on the page in question until the target item can be found. This search refinement is where the self-processing form comes to play. The search results are listed in a table with a radio button at the end of each row. What I...
5
2986
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 out how to do this in bash script as the requirement is necessary for a migration script to obtain the code from a .cfg file and then be able for the "parent" script to run the code it "imported" from the .cfg file, much like PHP's require() or...
4
2798
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: main(/includes/ReloadScript.html) : failed to open stream: No such file or directory in /usr/local/www/htdocs/main/AOLCompression.php on line 14 Fatal error: main() : Failed opening required '/includes/ReloadScript.html' (include_path='.:/usr/local/lib/php') in
15
6065
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 executed, the script terminates. Any ideas how I might solve this problem?
11
3125
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 searches, reports, etc. Thanks
31
4844
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
41076
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 debug_print_backtrace in the file to see how it is included, and here's the output: #0 require_once() called at #1 require_once(\eKirje.textGrid.class.php) called at #0 require_once() called at #1 require_once(\eKirje.kanava.class.php)...
5
2202
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 requires the class definitions available on EVERY page, as it unserialises everything even if it's not going to be used.
3
1932
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 MySQL and set up an Apache Alias. Eclipse reported several errors and warnings for scripts inside the "PHP Users" directory. These errors were caused by incorrect paths inside the include, require-once and require statements. I changed all of...
0
8375
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8707
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8482
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8593
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7306
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6161
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5622
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2714
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1916
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.