473,937 Members | 8,763 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Referring to Parent Folders

I don't know if this is a PHP config problem, or an Apache 1.3/PHP 4
problem, or what. When I include a script, say 2 folders up in the
structure, I'm having to move up to it instead of skipping to root and
moving down to it. Allow me to clarify, let's say my tree structure looks
like so [brackets indicate folder]:

[doc root]
-----[php]
---------- script.php
---------- [some folder]
--------------- [another folder]
-------------------- current.php

Let's then say that I want to include 'script.php' inside 'current.php'. As
it is now, I'm having to use include('../../script.php'). This is obviously
a nuisance, especially if I want to move things around. Now, I remember in
the past (different server config), using include('/php/script.php') would
work perfectly fine, but it does NOT work now, and I'd love for it to work.
Using /folder/file.ext works in regular HTML so I can only assume it is not
a problem with Apache. So my question is, is this simply a PHP config
problem?

PHP 4.3.4
Apache 1.3.something

Thanks!!!!!

Vinny


Jul 17 '05 #1
3 2168
Vinny wrote:
I don't know if this is a PHP config problem, or an Apache 1.3/PHP 4
problem, or what. When I include a script, say 2 folders up in the
structure, I'm having to move up to it instead of skipping to root and
moving down to it. Allow me to clarify, let's say my tree structure looks
like so [brackets indicate folder]:

[doc root]
-----[php]
---------- script.php
---------- [some folder]
--------------- [another folder]
-------------------- current.php

Let's then say that I want to include 'script.php' inside 'current.php'. As
it is now, I'm having to use include('../../script.php'). This is obviously
a nuisance, especially if I want to move things around. Now, I remember in
the past (different server config), using include('/php/script.php') would
work perfectly fine, but it does NOT work now, and I'd love for it to work.
Using /folder/file.ext works in regular HTML so I can only assume it is not
a problem with Apache. So my question is, is this simply a PHP config
problem?


look at your include_path

HTH
Bruno

Jul 17 '05 #2
Because include() use physical path and not your website root path (html).
You have to use the full physical path, something like
include("C:/wwwroot/user1/dom1/public_html/php/script.php") on windows or
include("/home/user1/dom1/public_html/php/script.php") on linux. But to be
simpler, you can also use the variable $_SERVER["DOCUMENT_R OOT"] which
return the physical up to your root.

include($_SERVE R["DOCUMENT_R OOT"] . "/php/script.php");

Note: This is not a problem as this way, you can include any file everywhere
on the system (unprotected). Also it's also applied to ASP-VBS and others
languages.

Savut

"Vinny" <hc*******@yaho o.com> wrote in message
news:tQ******** ***********@new sread3.news.atl .earthlink.net. ..
I don't know if this is a PHP config problem, or an Apache 1.3/PHP 4
problem, or what. When I include a script, say 2 folders up in the
structure, I'm having to move up to it instead of skipping to root and
moving down to it. Allow me to clarify, let's say my tree structure looks
like so [brackets indicate folder]:

[doc root]
-----[php]
---------- script.php
---------- [some folder]
--------------- [another folder]
-------------------- current.php

Let's then say that I want to include 'script.php' inside 'current.php'. As it is now, I'm having to use include('../../script.php'). This is obviously a nuisance, especially if I want to move things around. Now, I remember in the past (different server config), using include('/php/script.php') would
work perfectly fine, but it does NOT work now, and I'd love for it to work. Using /folder/file.ext works in regular HTML so I can only assume it is not a problem with Apache. So my question is, is this simply a PHP config
problem?

PHP 4.3.4
Apache 1.3.something

Thanks!!!!!

Vinny


Jul 17 '05 #3
thx, I'll start using that :)

"Savut" <we***@hotmail. com> wrote in message
news:DI******** ***********@new s20.bellglobal. com...
Because include() use physical path and not your website root path (html).
You have to use the full physical path, something like
include("C:/wwwroot/user1/dom1/public_html/php/script.php") on windows or
include("/home/user1/dom1/public_html/php/script.php") on linux. But to be simpler, you can also use the variable $_SERVER["DOCUMENT_R OOT"] which
return the physical up to your root.

include($_SERVE R["DOCUMENT_R OOT"] . "/php/script.php");

Note: This is not a problem as this way, you can include any file everywhere on the system (unprotected). Also it's also applied to ASP-VBS and others
languages.

Savut

Jul 17 '05 #4

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

Similar topics

2
2100
by: pietlinden | last post by:
I have a hopefully stupid question. First off, I'm trying to follow Keri Hardwick's instructions from here: http://www.mvps.org/access/forms/frm0031.htm I have a main/sub1/sub-subform: Contact/Donation/DonationType (I'm using Rebecca Riordan's subclassing article, which works great until I put the Donation Parent (with the Donation Child inside it)). Once I nest so there are 3 forms, one inside another:
21
2772
by: Mark Rae | last post by:
Hi, Apologies if this is a stupid question - I'm a C# newbie... :-) I have a Windows app with two form: frmConfigReg and frmNewApp. frmConfigReg is the startup form. It has several controls, including a GroupBox called grpApplications which itself contains a ComboBox called cmbApps and a button called cmdNewApp. When cmdNewApp is clicked, it loads frmNewApp which contains a text box where users enter the name of a new application to...
4
4582
by: Danny Tuppeny | last post by:
Hi all, I've been trying to write some classes, so when I have a parent-child relationship, such as with Folders in my application, I don't have to remember to add a parent reference, as well as adding to the child collection, eg: parent.Children.Add(child); child.Parent = parent;
1
1643
by: Brian P | last post by:
I have a class, Folder, that I want to hold a reference to its parent Folder as well as its subfolders. I'm using List<Folder> to hold its list of sub folders. What I want to do is when a folder is added to this list, automatically set the parent reference. But this seems impossible. It seems like I need to keep List<Folder> private and expose an "AddFolder" method that adds the folder to the list, and then also sets the folder's...
4
6509
by: MA | last post by:
Hi, How to access the total number of child nodes from a parent node. For example, I would like to get the total number of child nodes from <parent1and <parent2node. The SelectNodes method return the total number of <foldernodes (9) regardless of calling from the <parent1> and <parent2node. XML: ----------------------------------
6
96411
NeoPa
by: NeoPa | last post by:
Introduction The first thing to understand about Sub-Forms is that, to add a form onto another form takes a special Subform control. This Subform control acts as a container for the form that you want to act as a Sub-Form of the main one. That is to say, if you wanted frmB to act as a Sub-Form of frmA, then you would create a Subform control on frmA (in this example we'll call it sfmB). Subforms have a .Form property which contains a...
3
7718
by: Darin | last post by:
I have a problem I just can't figure out. I have a form with a subform, and the recordsource of the subform has criteria based on some unbound fields in the parent form so that data in the parent form affects data in the subform. I've had this type of setup often, but I've run across a couple forms where this has caused an "enter parameter value" pop up for each reference to the parent control in the query when the main form is closed. ...
4
9274
by: davin.pearson | last post by:
Here is my file index.php: <?php include "../parent.php"; ?> When I try to run this code on a Linux server, it gives me the following error message: Warning: main(): open_basedir restriction in effect. File(../
0
3888
by: alivip | last post by:
Is python provide search in parent folder contain sub folders and files for example folder name is cars and sub file is Toyota,Honda and BMW and Toyota contain file name camry and file name corola, file name honda contain folder accord and BMW contain file name X5 Is there way to enter name of parent folder(cars) and search in all sub folder(Toyota,Honda and BMW) and files ? how can I intgreat cod to be user interface (buttun ,text box...
0
10123
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
9955
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11501
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11078
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...
0
10641
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
9846
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
8202
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
7372
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();...
0
6063
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

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.