PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Thu Nov 14, 2019 12:46 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Wed Mar 06, 2013 7:03 pm 
Offline
Forum Newbie

Joined: Fri Dec 28, 2012 6:24 pm
Posts: 21
So, I recently was given a new server to work with, the only conditions were that it had to be Windows 2012 (64-bit), IIS8 and MSSQL. (I originally asked for a LAMP stack, oh well.)

All was going well until when I moved my old LAMP include folder to where I usually put it, just outside the webroot, and now all my includes aren't working.

php.ini - verified it is set by a echo ini_get('include_path'); & phpinfo();
Syntax: [ Download ] [ Hide ]
include_path = ".;c:\inetpub\inc"


Inside that folder is test.php, which has this code:
Syntax: [ Download ] [ Hide ]
<?php

echo "Hello!";

?>


And in the index of the webroot I have:
Syntax: [ Download ] [ Hide ]
<?php

include('test.php');

?>


file_exists can't even find it.

In Apache this would include the test.php from "c:\inetpub\inc" and echo "Hello!" on the page, under IIS it does not. Any ideas? I've spent a good portion of my day Googling this issue.

Everything else is working better than I was expecting.


Top
 Profile  
 
PostPosted: Wed Mar 06, 2013 7:51 pm 
Offline
Spammer :|
User avatar

Joined: Wed Oct 15, 2008 2:35 am
Posts: 6617
Location: WA, USA
So you get the error about file not found which mentions the include_path in the message?


Top
 Profile  
 
PostPosted: Wed Mar 06, 2013 7:54 pm 
Offline
Forum Newbie

Joined: Fri Dec 28, 2012 6:24 pm
Posts: 21
I'm sorry, what I meant was that file_exists appears to not be able to see outside of the web root.

EDIT: Now, that I actually type that out, could this be a file permission issue with php and the win server?

Ya, file_exists can see everything inside of c:\inetpub\wwwroot but not anything outside of that, I don't want to allow everyone read access to outside the webroot, but I also don't want to store my db include in the webroot, hmm.


Top
 Profile  
 
PostPosted: Wed Mar 06, 2013 8:49 pm 
Offline
Forum Contributor

Joined: Sun Sep 09, 2007 6:27 pm
Posts: 282


Top
 Profile  
 
PostPosted: Wed Mar 06, 2013 9:13 pm 
Offline
Forum Newbie

Joined: Fri Dec 28, 2012 6:24 pm
Posts: 21


Top
 Profile  
 
PostPosted: Wed Mar 06, 2013 9:21 pm 
Offline
Spammer :|
User avatar

Joined: Wed Oct 15, 2008 2:35 am
Posts: 6617
Location: WA, USA
Are you using double " quotes in your test? Because that's a problem: that \f you have tucked in there is a form feed character. Try with single ' quotes.


Top
 Profile  
 
PostPosted: Wed Mar 06, 2013 10:02 pm 
Offline
Forum Newbie

Joined: Fri Dec 28, 2012 6:24 pm
Posts: 21
Bah, you're right. Such a rookie mistake. I knew that one too. :P

Corrected:
Syntax: [ Download ] [ Hide ]
<?php
echo ini_get('include_path');
include('test.php');

$filename='C:\inetpub\inc\functions.inc.php';
If(!file_exists($filename)){
    echo "what file?"; // still getting this.
}
else{
    echo "FOUND IT!";
}
$filename='C:\inetpub\wwwroot\index.php';
If(!file_exists($filename)){
    echo "what file?";
}
else{
    echo "FOUND IT!"; // still getting this.
}
?>


Edit: Still doesn't work. :(


Top
 Profile  
 
PostPosted: Thu Mar 07, 2013 7:50 am 
Offline
Forum Newbie

Joined: Fri Dec 28, 2012 6:24 pm
Posts: 21
Alright, it was a Windows permissions issue, kinda embarrassing I didn't try this originally, but I am a linux/Apache guy, but at least I know more about IIS and Windows now. :) If anyone ever runs into this issue, For Windows 2012, if you want includes to work, you have to right click the folder, Properties, Security, and give Everyone read access to the folder.

Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group