473,403 Members | 2,323 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,403 software developers and data experts.

Mapping the Path

Any recommendations on the best way to map paths?

require('./library/include/file1.php');

works well for files in the root folder, but for files in another
folder, I need to rewrite the path to the files, and sometimes
when testing things on my personal system, they work there,
but fail when uploaded to the website. Using the root...

require('/library/include/file1.php);

doesn't seem to work as I thought it would. It's like the
server maps the '/' to something unknown. There a way
to find out what '/' gets mapped to inside the require()
function?

Any suggestions? Thanks much.

Messing with PHP 4.4.1 (Windows XP, Apache 1.3.34
(Win32)) on my system and PHP 4.3.11 (Unix-Apache
1.3.31) on the host.

Jim Carlock
Post replies to the newsgroup.
Dec 31 '05 #1
5 1453
Jim Carlock wrote:
Any recommendations on the best way to map paths?


IMO, the most convenient way to do this is to add a php_value directive to
the httpd.conf file:

php_value include_path ".;C:/Path to includes dir"

Or when using virtual hosts:

<VirtualHost *:80>
php_value include_path ".;C:/Path to includes dir"
...
</VirtualHost>
JW
Jan 1 '06 #2
Janwillem Borleffs wrote:
IMO, the most convenient way to do this is to add a php_value
directive to the httpd.conf file:


Forgot to mention, with this added to the httpd.conf file, you can simply
do:

include 'whatever.php';

From each location in and below the site's document root and whatever.php
will be retrieved when it's either in the current working dir or in the
defined include path (searched for in that specific order).
JW
Jan 1 '06 #3
"Janwillem Borleffs" <jw@jwscripts.com> suggested:
IMO, the most convenient way to do this is to add a
php_value directive to the httpd.conf file
php_value include_path ".;C:/Path to includes dir"


Happy New Year! Thanks for the comment about php_value.

I ran across the include_path item in a few pages at php.net.

http://us3.php.net/manual/en/print/i...i.include-path

And the content of that page left me puzzled as to how or where
to place that. Also, the Unix server that the site I'm deploying to
is a hosting company. IS there a way to edit the httpd.conf file
through PHP?

And I'm trying to get some other things working to find out what
modules are installed... tried...

apache_get_modules()

but that particular item is failing on my local machine.
apache_get_version() works and returns the version.

Also, found the include_path in the php.ini file. So that is
probably what I'm looking for on the local Windows
system. But will that work for the remote Apache (Unix)
server when I don't know where or how to get to it ?

The other things found in the php.ini file include:

doc_root =
user_dir =

I'm thinking my problem is an Apache problem, and I need
to create a couple virtual hosts.

For the meantime I'm going to have to stick to 100% relative
addressing for all my includes rather than using virtual root
addressing.

Unless there's a way to configure the doc_root variable to use
use a different root for two or more virtuals.

Again, thank you and Happy New Year to everyone.

Jim Carlock
http:// 70.124.31.73
Post replies to the newsgroup.
Jan 1 '06 #4
Jim Carlock wrote:
And the content of that page left me puzzled as to how or where
to place that. Also, the Unix server that the site I'm deploying to
is a hosting company. IS there a way to edit the httpd.conf file
through PHP?

Most configurations support .htaccess overrides, Just put a file called
..htaccess (so: dot htaccess) in de root of your webfolder and put the
php_value directive in there.
And I'm trying to get some other things working to find out what
modules are installed... tried...

apache_get_modules()

but that particular item is failing on my local machine.
apache_get_version() works and returns the version.

Then, you probably installed PHP as CGI. On my system, where PHP runs as a
module, there isn't any problem with this function.
Also, found the include_path in the php.ini file. So that is
probably what I'm looking for on the local Windows
system. But will that work for the remote Apache (Unix)
server when I don't know where or how to get to it ?


For this you should test the .htaccess approach mentioned before. BTW, this
approach will also work on Windows systems.
JW
Jan 1 '06 #5
On Sat, 31 Dec 2005 21:15:34 +0000, Jim Carlock wrote:
Any recommendations on the best way to map paths?

require('./library/include/file1.php');

works well for files in the root folder, but for files in another
folder, I need to rewrite the path to the files, and sometimes
when testing things on my personal system, they work there,
but fail when uploaded to the website. Using the root...

require('/library/include/file1.php);

doesn't seem to work as I thought it would. It's like the
server maps the '/' to something unknown. There a way
to find out what '/' gets mapped to inside the require()
function?

Any suggestions? Thanks much.

Messing with PHP 4.4.1 (Windows XP, Apache 1.3.34
(Win32)) on my system and PHP 4.3.11 (Unix-Apache
1.3.31) on the host.

Jim Carlock
Post replies to the newsgroup.

require ( $_SERVER['DOCUMENT_ROOT'] . "/library/include/file1.php" );

will allow you to access anything under docroot, which is probably the
only stuff you can be sure of when on a shared server.

Steve
Jan 1 '06 #6

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

Similar topics

2
by: Frank | last post by:
Hi there, In web.xml, I know it's possible to do path mapping: <path-mapping url-pattern="/aaa/*" real-path="C:\TEMP\"/> So a call to myserver.com/mywebapp/aaa will redirect to c:\temp. ...
20
by: Pierre Fortin | last post by:
Hi! "Python Essential Reference" - 2nd Ed, on P. 47 states that a string format can include "*" for a field width (no restrictions noted); yet... >>> "%*d" % (6,2) # works as expected ' ...
0
by: rabbit | last post by:
Hi all, i have xml documents with the following DTD: <!ELEMENT directory (host+)> <!ELEMENT host (host+ | path+)> <!ATTLIST host name CDATA #REQUIRED> <!ELEMENT path (path+ | doc_info)>...
0
by: Vladimir | last post by:
How I can get the information about mapping path of the substituted drive from C# code. For example I have created the substitution using the command: C:\>subst r: "C:\Program Files" C:\>subst...
4
by: BentleyInc | last post by:
I'm trying to find a way to add a whildcard application mapping to aspnet_isapi.dll in IIS programmatically.... been looking into IIS administrator reference but didn't find the right function to...
6
by: Michael Tissington | last post by:
I'm trying to add some extensions to IIS on the properties, home directory, config screen. I must be missing something because the OK button is always disabled ... Any ideas please ? --...
1
by: Johan | last post by:
My problem is that I want to set file permission on a file on the network using WMI, but the folder might not be mapped which ,as far as I know, WMI needs. So my solution to this would be to map...
0
by: Arthur Dent | last post by:
I have a PageBase class I use which has a bunch of properties to get various "path" components for the page... such as: protocol: http server: www.myserver.com full: ...
13
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
I am actually trying to get the UNC path of the main module of a process running from a mapped drive, and I am trying to do this from a service. The ProcessModule class only provides the full path...
10
by: =?Utf-8?B?Z3JlYXRiYXJyaWVyODY=?= | last post by:
Sorry about that previous one. I pressed enter too early. How does one go about mapping a network drive in C#. i know you use MapNetworkDrive in scripting languages, but i'm not sure how to do it...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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,...
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.