Solved

# Php inclusion error

Posted on 2006-04-07
Medium Priority
376 Views
when I try to access some php pages, I get this error:

Warning: Failed opening 'E:\websites\cms\index.php\admin\user\login\' for inclusion (include_path='.;C:\php\includes;C:\php\pear') in Unknown on line 0

I am using Windows xp+iis+php

I installed php at c:\php; there are two folders, includes (no files) and pear (many files) under c:\php

My php.ini is at c:\windows\system32.

a fragement of php.ini is:

include_path = ".;C:\php\includes;C:\php\pear"

Where did I make mistakes? Thanks

Thanks
0
Question by:tiger0516
• 4

LVL 7

Expert Comment

ID: 16400269
The php page you are trying to access is in turn calling additional files that it cant find. This is probably going to be less about how php is installed and specifically related to the scripts your running and getting the errors from. Without knowing whats scripts they are running or seeing some code it will be tough to point out the exact cause.

0

LVL 18

Expert Comment

ID: 16401892
Hi tiger, you haven't made a mistake when installing php or the path to your pear libraries.

When you include your files in your php file, make sure that they are relative to the script.  If you are using a slash before the directory and file name (e.g. include("/mydirectory/myfile.php"), sometimes php could interpret this slash as an actual disk path.  Be sure to use something like this instead include("mydirectory/myfile.php").  Failing that then you need to ensure that your files that you are including actually exist.
0

LVL 18

Expert Comment

ID: 16402135
Oh, I've also just noticed that you have e:\websites\cms\index.php\admin\user\login\ as your path to the file that was being included.  This is interesting because there is a file called index.php in the cms directory, so how can a file have directories after it as in \admin\user\login\?  This could mean that you are calling a function similar to:

include($_SERVER["DOCUMENT_ROOT"].$_SERVER["PHP_SELF"]."/admin/user/login/");

or

include($_SERVER["PATH_TRANSLATED"]."/admin/user/login"); Now, I'm also not sure why the directory login is being called in the include. There should actually be a file in the login directory that the include is trying to locate, however your error above doesn't state what the file should be called. This is very strange. I've tried these functions out and both have produced very similar results to the one you have provided above and I get the error firstly because the files don't exist and also because the include is calling a directory after the file name. If you can find out what the file is called, I would rewrite the include to something like: include("/admin/user/login/login.php"); or something along those lines and then your script will be able to resolve it's path and retrieve the contents of that file for inclusion. Furthermore, if the absolute path is required then you could simply remove the$_SERVER["PHP_SELF"] part from the first bit of code above, eg:

Additionally, it is possible that the CMS you are using is not fully supported by windows due to the differences in directory calling.  In this case I would contact the developers of the scripts you are using and state the above error message.  It's possible that they could provide a fix, or there may already be one published on their forums.

Hope this helps.
0

LVL 1

Author Comment

ID: 16405137
Hi Lhotch & ingwa,

I just realized it is probably because of URL rewrite. My program, EZ publish, is supposed to run in Apache, which has built-in URL rewrite support. However, due to our IT personeel cannot install Apache for us, I have to use IIS and I built my local machine the same config our server is.

It is really a big problem.
0

LVL 18

Accepted Solution

Mark Gilbert earned 2000 total points
ID: 16405893
Tiger, I have previously managed to successfully run php on IIS using the api or dll that php provides for integration.  Whilst this process is complicated to get perfect, it can be done.  However I hope that the above examples have helped you narrow down the issues with your include that you first stated.  As far as I see, PHP is correctly running, however to confirm this, there are three commands that I would recommend that you try in a test.php file.

Firstly, setup a file called phpinfo.php and include the following line in it:

<? echo phpinfo(); ?>

This should give you a very nicely formatted webpage which gives you a very detailed explanation on your php system and what is included in the libraries such as pear, GD, curl, etc.

Secondly, open up test.php as a blank text document and type in <? echo "hello"; ?>.  If this prints hello into the page when you browse it then the basics of php are correctly setup.

Finally, setup a file called test2.php and have this statement in it:

<? include("test.php"); ?>

This should have the same results as what you got in test.php.  If this runs correctly then I certainly don't see a problem with your php setup.  What I would further recommend is having a look at the IIS server error logs to see what the php api is sending to it.  These can be pretty useful in diagnosing problems with your scripts, or php setup.

Hope this helps.

0

LVL 18

Expert Comment

ID: 16413461
Tiger, I'm happy to hear that you found some of my suggestions above useful.  Would it be possible to know what the solution was?  It could be helpful for other people in your situation to know exactly what helped, and would help my curiosity :)  Thanks for the points and for the grade.
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.
###### Suggested Courses
Course of the Month14 days, 4 hours left to enroll

#### 809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.