473,805 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Includin files in the parent directory

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(../
parent.php) is not within the allowed path(s): (.) in \
\192.168.1.16\w ebfiles\files\2 007-6\1475215\inner \index.php on line 3

Warning: main(../parent.php): failed to open stream: Operation not
permitted in \\192.168.1.16\ webfiles\files\ 2007-6\1475215\inner
\index.php on line 3

Warning: main(): Failed opening '../parent.php' for inclusion
(include_path=' .;c:\php\includ es') in \\192.168.1.16\ webfiles\files
\2007-6\1475215\inner \index.php on line 3

What gives?

Jun 16 '07 #1
4 9264
On Jun 16, 2:21 pm, "davin.pear...@ gmail.com"
<davin.pear...@ gmail.comwrote:
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(../
parent.php) is not within the allowed path(s): (.) in \
\192.168.1.16\w ebfiles\files\2 007-6\1475215\inner \index.php on line 3

Warning: main(../parent.php): failed to open stream: Operation not
permitted in \\192.168.1.16\ webfiles\files\ 2007-6\1475215\inner
\index.php on line 3

Warning: main(): Failed opening '../parent.php' for inclusion
(include_path=' .;c:\php\includ es') in \\192.168.1.16\ webfiles\files
\2007-6\1475215\inner \index.php on line 3

What gives?
try chmod 555 parent_dir

Jun 16 '07 #2
At Sat, 16 Jun 2007 06:21:07 +0000, da***********@g mail.com let h(is|er)
monkeys type:
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(../
parent.php) is not within the allowed path(s): (.) in \
\192.168.1.16\w ebfiles\files\2 007-6\1475215\inner \index.php on line 3

Warning: main(../parent.php): failed to open stream: Operation not
permitted in \\192.168.1.16\ webfiles\files\ 2007-6\1475215\inner
\index.php on line 3

Warning: main(): Failed opening '../parent.php' for inclusion
(include_path=' .;c:\php\includ es') in \\192.168.1.16\ webfiles\files
\2007-6\1475215\inner \index.php on line 3

What gives?
Exactly what the first error indicates. You have an open_basedir
restriction set in your php.ini, which limits file access to files only
from that directory plus its subdirs.

http://www.php.net/manual/en/feature...i.open-basedir

You either have to modify the setting in php.ini or move your include
file to a directory withing the allowed path.

HTH
--
Schraalhans Keukenmeester - sc*********@the .Spamtrapexampl e.nl
[Remove the lowercase part of Spamtrap to send me a message]

"strcmp('apples ','oranges') < 0"

Jun 16 '07 #3
On Jun 16, 7:37 pm, Schraalhans Keukenmeester
<Schraalh...@th e.spamtrapexamp le.nlwrote:
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(../
parent.php) is not within the allowed path(s): (.) in \
\192.168.1.16\w ebfiles\files\2 007-6\1475215\inner \index.php on line 3
Warning: main(../parent.php): failed to open stream: Operation not
permitted in \\192.168.1.16\ webfiles\files\ 2007-6\1475215\inner
\index.php on line 3
Warning: main(): Failed opening '../parent.php' for inclusion
(include_path=' .;c:\php\includ es') in \\192.168.1.16\ webfiles\files
\2007-6\1475215\inner \index.php on line 3
What gives?

Exactly what the first error indicates. You have an open_basedir
restriction set in your php.ini, which limits file access to files only
from that directory plus its subdirs.

http://www.php.net/manual/en/feature...i.open-basedir

You either have to modify the setting in php.ini or move your include
file to a directory withing the allowed path.
Here is the contents of php.ini.

open_basedir = /

When I uploaded it to my ripway.com user account "davin", it still
gave the same errors when you try to view the following PHP code page:
http://h1.ripway.com/davin/inner/index.php

Is there an error in my php.ini?

Is php.ini located in the correct place? Note that I do not have a
public_html folder.

Ideally I want php to be able to access all of my folders. What is
the syntax for specifying multiple dirs to the variable open_basedir?
Jun 18 '07 #4
da***********@g mail.com wrote:
On Jun 16, 7:37 pm, Schraalhans Keukenmeester
<Schraalh...@th e.spamtrapexamp le.nlwrote:
>>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(../
parent.php) is not within the allowed path(s): (.) in \
\192.168.1.16 \webfiles\files \2007-6\1475215\inner \index.php on line 3
Warning: main(../parent.php): failed to open stream: Operation not
permitted in \\192.168.1.16\ webfiles\files\ 2007-6\1475215\inner
\index.php on line 3
Warning: main(): Failed opening '../parent.php' for inclusion
(include_path ='.;c:\php\incl udes') in \\192.168.1.16\ webfiles\files
\2007-6\1475215\inner \index.php on line 3
What gives?
Exactly what the first error indicates. You have an open_basedir
restriction set in your php.ini, which limits file access to files only
from that directory plus its subdirs.

http://www.php.net/manual/en/feature...i.open-basedir

You either have to modify the setting in php.ini or move your include
file to a directory withing the allowed path.

Here is the contents of php.ini.

open_basedir = /

When I uploaded it to my ripway.com user account "davin", it still
gave the same errors when you try to view the following PHP code page:
http://h1.ripway.com/davin/inner/index.php

Is there an error in my php.ini?

Is php.ini located in the correct place? Note that I do not have a
public_html folder.

Ideally I want php to be able to access all of my folders. What is
the syntax for specifying multiple dirs to the variable open_basedir?

You can't override is parameter in a user's php.ini file. It must be in
the system one (or Apache configuration), for security reasons.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jun 18 '07 #5

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

Similar topics

2
14171
by: Mike | last post by:
I am sure that I am making a simple boneheaded mistake and I would appreciate your help in spotting in. I have just installed apache_2.0.53-win32-x86-no_ssl.exe php-5.0.3-Win32.zip Smarty-2.6.7.tar.gz on a system running WindowsXP SP2. Apache and PHP tested out fine. After adding Smarty, I ran the following http://localhost/testphp.php
2
8931
by: Matt | last post by:
Hello, I am writing a script that opens needs to get a listing of files in a directory, print that listing to a file and use that file as a quasi ftp control file. My problem is that when I print the filenames found via the readdir I also get the . and .. (current directory and parent directory) written in the ftp control file which causes my script to stop since you can't ftp . nor .. Here's my logic ....
2
1629
by: MDW | last post by:
I’ve got a menu file that’s saved as an .shtml document. I don’t want to post the code, but essentially it’s a simple HTML table, with an XSL template wrapped around it. This way, I can include the file from HTML, ASP, or from an XML stylesheet. The actual file inclusion works fine. My problem is that the menu uses images, which are saved in a different directory than the include file itself. The overall web structure is this: ...
5
13474
by: Edward Mitchell | last post by:
I am trying to include two class files into a web service project. The structure I have is a top level solution and project in a folder and below that, the web service project in it's own folder. In the top level folder I have two class files, classA.cs and classB.cs. In the web service project, I use Add>Existing Item... and browse to select the files in the parent directory. Unfortunately, when I hit the Open button in the file...
10
7841
by: Martin Ho | last post by:
I am running into one really big problem. I wrote a script in vb.net to make a copy of folders and subfolder to another destination: - in 'from.txt' I specify which folders to copy - in 'to.txt' I specify where to copy it - After I read content of 'to.txt' I create one more subfolder named by current date and thats where everything gets to be copied
23
2444
by: **Developer** | last post by:
Is there an easy way to copies all files in a directory into another directory? What about coping subdirectories too? Thanks in advance for any info
1
1251
by: Military Smurf | last post by:
Okay, so I have some code that can do a recursive search to get the raw number of files and folders. No big. As a user, I can right click on any parent folder, get the properites, and then on the general tab, the number of child files and folders are retrieved after a few seconds. Is there any property or anything at all in VB.NET that allows you to access THIS specific information? I'm just looking for an alternate way to get all the...
2
2680
by: Alan Bak | last post by:
HI I am running Active Perl on a Windows XP machine. I am hoping to get some advise on a strategy to monitor and copy files that are arriving in a directory and need to be copied to a second location. Files will arrive at the rate of one every 2 to 4 seconds into a directory immediately below the parent. The number of files written to each directory will vary and the number of directories written will also vary (typically the number of...
2
3851
by: supra91 | last post by:
Hi, I have to read files from the parent directory and delete those files. This parent directory contains logs files. This directory also contains some sub directories and I do not want to delete files from these sub directories. I am using this code opendir(DIR, $lpath); @flist = readdir(DIR); closedir(DIR); when I do this @flist also contains files from sub directories and I do want that. How can I avoid reading files from...
0
9718
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
10614
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...
1
10369
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
10109
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
9186
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
7649
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
6876
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
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3847
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.