I am running IIS 5.0 and I need someone to help me out with configuring application mappings.
I need to set up IIS to parse PHP files first for Server-Side Includes (SSI) and then parse the file for PHP commands. The IIS text box in which you type the location of the executable to parse the file with will not allow you to use multiple executables.
I've searched just about everywhere, and unfortunately, I can't find any place that knows how to set up multiple mappings for a single file type.
Please reply soon!
Thanks in advance,
David Bindel
Configuring IIS 5 to parse PHP and SSI on the same file
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Configuring IIS 5 to parse PHP and SSI on the same file
ok... well then let me explain my problem with using PHP's include function:
I *would be* using PHP's include() function to include a header and footer on every page of my website, but since my implements database connections on some pages, I use code similar to the following:
mysql_select_db("my_db") or die("<p>Could not select database.</p>");
In using the die() function, it displays the message inside of it and stops all PHP processing instead of displaying a really ugly unprofessional PHP error.
But since that die() function has stopped the PHP processing, my footer file is not included at the bottom of the page.
I'm sure someone else has had this problem in the past... could you please help me?
Thanks in advance!
David Bindel
I *would be* using PHP's include() function to include a header and footer on every page of my website, but since my implements database connections on some pages, I use code similar to the following:
mysql_select_db("my_db") or die("<p>Could not select database.</p>");
In using the die() function, it displays the message inside of it and stops all PHP processing instead of displaying a really ugly unprofessional PHP error.
But since that die() function has stopped the PHP processing, my footer file is not included at the bottom of the page.
I'm sure someone else has had this problem in the past... could you please help me?
Thanks in advance!
David Bindel
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
What I've done is to create a function similar to this:
where $path is the path to my domain's root directory and included the file containing the function on all pages. In order to stop the problems with the footer not being included when die() executes I then have:
Then any other code is halted but the footer is still included.
Hope this helps,
Mac
Code: Select all
function include_footer()
{
global $path;
include $path.'includes/footer.php';
}Code: Select all
$connect = mysql_connect($host, $user, $pass) or die('<p>No database connection</p>'.include_footer());Hope this helps,
Mac
It's not necessary to make the script end. Continue to do it if you want, but, you can do this instead:
That keeps the script running, but it also displays your error message.
Code: Select all
<?php
function error($msg) {
echo $msg;
}
mysql_connect($host,$user,$pass) || error('Unable to select database.');
mysql_connect($host,$user,$pass) || error(mysql_error());
?>- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Does that mean that errors arising from the fact that information in the database wasn't available will also be shown?
Edit: Answered my own question:
Yes it does, at least in my experimentation. I think that or die() makes it more dramatic anyway
but either way you have to write a function to do something whether that's showing an error message or including a file.
Mac
Edit: Answered my own question:
Yes it does, at least in my experimentation. I think that or die() makes it more dramatic anyway
Mac