Need help with php 5.2.11 and IIS v6.0
Moderator: General Moderators
Need help with php 5.2.11 and IIS v6.0
After a long fight with iis and php I can get my web page to display a simple phpinfo() script. But when I try to use php in another page I get the following error:
Warning: require_once(1) [function.require-once]: failed to open stream: No such file or directory in E:\website.com\index.php on line 8
Fatal error: require_once() [function.require]: Failed opening required '1' (include_path='.;C:\php5\pear') in E:\website.com\index.php on line 8
The person who designed the web page insists that there is not a problem with the code, and the problem must be with either the php.ini file or iis. I don't even know where to begin to fix this issue. Please help me. Thanks.
Warning: require_once(1) [function.require-once]: failed to open stream: No such file or directory in E:\website.com\index.php on line 8
Fatal error: require_once() [function.require]: Failed opening required '1' (include_path='.;C:\php5\pear') in E:\website.com\index.php on line 8
The person who designed the web page insists that there is not a problem with the code, and the problem must be with either the php.ini file or iis. I don't even know where to begin to fix this issue. Please help me. Thanks.
- iankent
- Forum Contributor
- Posts: 333
- Joined: Mon Nov 16, 2009 4:23 pm
- Location: Wales, United Kingdom
Re: Need help with php 5.2.11 and IIS v6.0
At a quick glance it looks like line 8 of index.php is calling require_once(1), which afaik would do nothing? Could you copy and paste the require_once line 8 from index.php for us, might be a bit clearer as to what the problem is.
Its almost certainly a file can't be found for some reason, it just depends why
hth
Its almost certainly a file can't be found for some reason, it just depends why
hth
Re: Need help with php 5.2.11 and IIS v6.0
Here is line 8:
require_once("./private/dbaccess.php") or die("can't find dbaccess");
Yes, I'm sure that the folder private, and the file dbaccess.php exist.
Here is an interesting side note I found out. This error only happens when iis is in iis5.0 isolation mode, if iis is not in isolation mode, then any php page will ask me for a user name and password, but no matter what I enter the webpage will not accept it. This only happens with php pages, any html page displays fine.
require_once("./private/dbaccess.php") or die("can't find dbaccess");
Yes, I'm sure that the folder private, and the file dbaccess.php exist.
Here is an interesting side note I found out. This error only happens when iis is in iis5.0 isolation mode, if iis is not in isolation mode, then any php page will ask me for a user name and password, but no matter what I enter the webpage will not accept it. This only happens with php pages, any html page displays fine.
- iankent
- Forum Contributor
- Posts: 333
- Joined: Mon Nov 16, 2009 4:23 pm
- Location: Wales, United Kingdom
Re: Need help with php 5.2.11 and IIS v6.0
Does the 'private' folder exist in the same folder you're running the script from? Usually the private folder would be outside of 'htdocs', so for example:JasonS135 wrote:Here is line 8:
require_once("./private/dbaccess.php") or die("can't find dbaccess");
Yes, I'm sure that the folder private, and the file dbaccess.php exist.
Here is an interesting side note I found out. This error only happens when iis is in iis5.0 isolation mode, if iis is not in isolation mode, then any php page will ask me for a user name and password, but no matter what I enter the webpage will not accept it. This only happens with php pages, any html page displays fine.
E:/home/user/private/
E:/home/user/htdocs/
E:/home/user/htdocs/yourscript.php
If that's the case, you need to use ../private rather than ./private to go up one level.
Afaik isolation mode tells IIS to use a single-threaded environment for scripts and applications? Not 100% sure as I don't personally use it. Can't see why that should make any difference to the above php error, unless for some reason IIS is doing something weird with the PHP engine.
Could you try using the full path to the dbaccess.php file and see if you get the error then or not?
Re: Need help with php 5.2.11 and IIS v6.0
I used the full file path and I'm still getting the same error
- iankent
- Forum Contributor
- Posts: 333
- Joined: Mon Nov 16, 2009 4:23 pm
- Location: Wales, United Kingdom
Re: Need help with php 5.2.11 and IIS v6.0
I'd assume your IIS or PHP configuration is incorrect. If its asking for username and password while not in isolation mode then it sounds more like an IIS problem. Don't know what to suggest, not an IIS user myself! You could switch to XAMPP unless you have to use IIS? Apache is a much better server (albeit a little more difficult to configure) than IIS!
Re: Need help with php 5.2.11 and IIS v6.0
It may very well be iis. Can I use Apache or XAMPP if the server also uses microsoft exchange and the default iis website (company web)?
- iankent
- Forum Contributor
- Posts: 333
- Joined: Mon Nov 16, 2009 4:23 pm
- Location: Wales, United Kingdom
Re: Need help with php 5.2.11 and IIS v6.0
If you need to keep IIS running then you can still use Apache or XAMPP (which uses Apache) but you'll need to change the default port number from 80 to something not in use (81 is usually a good choice
)
It means you'll then have to access it using http://localhost:81/ instead, but that shouldn't be a major problem
one thing I'd say though, don't install XAMPP or Apache just for development on a live server - that's asking for trouble! You should never use your live servers as development servers just in case things go wrong
(with me they often do
)
It means you'll then have to access it using http://localhost:81/ instead, but that shouldn't be a major problem
one thing I'd say though, don't install XAMPP or Apache just for development on a live server - that's asking for trouble! You should never use your live servers as development servers just in case things go wrong
Re: Need help with php 5.2.11 and IIS v6.0
Ok thanks, that may be my fall back plan. I've almost got php working with iis. I can get phpinfo() to display and echo statements, but when I try to use a function like require_once the page will not display at all, no errors or anything, just a blank page. Any ideas? Thanks.
- iankent
- Forum Contributor
- Posts: 333
- Joined: Mon Nov 16, 2009 4:23 pm
- Location: Wales, United Kingdom
Re: Need help with php 5.2.11 and IIS v6.0
Seems very odd. If you keep the files really simple and put them in the same folder, does it still do the same? E.g.
/htdocs/index.php
/htdocs/something.php
Also, do you have access to the server error logs? If its a live server chances are errors are being sent to the server error log instead of displaying them (prevents PHP accidentally leaking info about your database etc)
hth
/htdocs/index.php
Code: Select all
<?
require('something.php');
phpinfo();
?>
Code: Select all
for($i = 1; $i < 100; $i++){
echo $i;
}
hth
Re: Need help with php 5.2.11 and IIS v6.0
Nope, same thing happening even if I put the files in the same folder. Where would I find the php error logs?
- iankent
- Forum Contributor
- Posts: 333
- Joined: Mon Nov 16, 2009 4:23 pm
- Location: Wales, United Kingdom
Re: Need help with php 5.2.11 and IIS v6.0
You should be able to find out in your IIS configuration somewhere. If its not obvious, try googling for IIS log files and see what comes up.
Once you've found your error logs, you should hopefully see some entries telling you whats wrong. If they don't make sense, copy and paste any bits you think are relevant here and we'll have a look (check carefully for any sensitive data)
Once you've found your error logs, you should hopefully see some entries telling you whats wrong. If they don't make sense, copy and paste any bits you think are relevant here and we'll have a look (check carefully for any sensitive data)
Re: Need help with php 5.2.11 and IIS v6.0
Ok I checked the errors and it is giving me the same two errors that I posted in my first post.
- iankent
- Forum Contributor
- Posts: 333
- Joined: Mon Nov 16, 2009 4:23 pm
- Location: Wales, United Kingdom
Re: Need help with php 5.2.11 and IIS v6.0
Very strange, the only thing I can suggest is that the file either doesn't exist, or doesn't have the correct permissions for IIS.
Are you able to access the included file directly? For example, with my code with both the files in the same folder, can you navigate to something.php and see it output numbers 1-10? if not then the problem is permissions or file location
Are you able to access the included file directly? For example, with my code with both the files in the same folder, can you navigate to something.php and see it output numbers 1-10? if not then the problem is permissions or file location