Forum Moderators: coopster
I have a includes folder with all the including files in the root folder.
<root folder>/includes/files.php
These includes files are working fine in the root folder and there sub folder. That is
<root folder>files.php
<root folders>/sub folder/files.php
But for the files of sub folder of sub folder it is not showing correct path. The images are link are not taking the correct path. That is the wrong files are
<root folder>/sub folder/sub folder/files.php
I went through many articles on the same subject and got to know that i should give path like '/includes/header.php'. I didn't know whether i got it correct or not. Please comment on this.
But this is also not working.
Error is like this:
Warning: main(/includes/header.php) [function.main]: failed to open stream: No such file or directory in D:\My Documents\Swarajpeeth\Website\website\mediaroom\articles\index.php on line 29
Warning: main() [function.include]: Failed opening '/includes/header.php' for inclusion (include_path='.;C:\php5\pear') in D:\My Documents\Swarajpeeth\Website\website\mediaroom\articles\index.php on line 29
Here i want to tell you one thing. I had not yet uploaded these file on the server. I am testing them on my local system. With Php installed.
What should i do?
What should be the include path?
Is there problem in configuring my local server? If yes then how to rectify it?
Thanks in advance,
Pathak
. Include paths can either be defined in php.ini or in a .htaccess file. Maybe you don't have access to the php.ini file on your live server, in which case .htaccess is going to be your only choice
. The syntax is slightly different on Windows and Unix boxes
. As you use the local file system to define paths, chances are that whatever you use on your local box will not be the same as your live server, so you'll need to setup two sets of paths
In php.ini there should already be a line that starts with:
include_path = " ...
In .htaccess (if you have one) you'll need to add a line starting with:
php_value include_path " ...
The first path, signified by a '.', means look in the same folder as the script that's running. This is why scripts in your root directory were picking up the includes, and not the ones in subdirectories.
So for a .htaccess file on a Windows box:
php_value include_path = ".;c:\pathtomysite\htdocs\includes;c:\anotherdirectory"
PHP will look through these directories in order until it finds your include.
For Unix, it'll look something like:
php_value include_path ".:/usr/local/psa/home/vhosts/mysite/httpdocs/includes"
Note that the separator changes to a ':' and the different direction of the slashes.
I did chages to php.ini but the problem still persist.
I am sorry in advance but I think i am going to ask a very childiss question.
Please tell me how to make .htaccess file. Please give me the format of .htaccess with special consideration on include details.
Where i have to save this file?
[httpd.apache.org...]
[httpd.apache.org...]