Page 1 of 2

why does the index.php file display the code?

Posted: Wed May 21, 2003 11:20 am
by adneg
:cry: I have installed PHP and can see the phpinfo(), but when I try to view my development website all i see is the code in the index.php.


My virtual host is setup correctly, mysql is running and also Apache. I have this added AddType application/x-httpd-php .php in the http.conf file.


I am really lost with this one

Posted: Wed May 21, 2003 3:19 pm
by Wayne Herbert
If you can see the phpinfo page then that suggests that you are set up correctly for php.

Are you loading your website via a file id or a URL? The first won't work, the second will.

If all above is correct, post the code.

Posted: Wed May 21, 2003 7:47 pm
by volka
and check wether the index.php script uses short tags <? ... ?>
They might be disabled.
http://www.php.net/manual/en/configurat ... t-open-tag

Posted: Thu May 22, 2003 11:20 am
by adneg
the code is:

<?php header("Location: http://fletcher.co.uk/site/site.php/hom ... newsession"); ?>


Calling the script using http://www.fletcher.co.uk

Volka as you can see the index.php uses <? ?>, i have checked and it is on.

Posted: Thu May 22, 2003 11:24 am
by liljester
"index.osp"? did you configure apache so that it would execute .osp files?

Posted: Thu May 22, 2003 11:31 am
by adneg
no i did not. What is the best way to do this? hopefully without breaking it.

Posted: Thu May 22, 2003 11:40 am
by liljester
did you use the .osp file extension on purpose? why not just use index.php instead of index.osp?

Posted: Sun May 25, 2003 5:02 am
by adneg
The site was designed by a web design company so I do not know why they used the .osp.

I am trying to have a copy of the site at home so that I can do development work on it before putting it on the live site.

is there anybody who can point me in the right direction for what I have to do?

Posted: Sun May 25, 2003 5:38 am
by volka
I have this added AddType application/x-httpd-php .php in the http.conf file.
This told apache that files with the extension .php are of the mimetype application/x-httpd-php (that is handled by the php module).
Now you want to tell apache that files with the extension .osp are of the same mimetype...

(there's no way of asking the designer "why .osp?" ?)


http://httpd.apache.org/docs-2.0/mod/mo ... ml#addtype

Posted: Sun May 25, 2003 6:11 am
by adneg
Ok, I will add the line
AddType application/x-httpd-osp .osp?

and hope it works

Posted: Sun May 25, 2003 6:14 am
by volka
you don't want to tell apache the files are of the mimetype application/x-httpd-osp because mod_php doesn't handle it.
But it handles application/x-httpd-php for as many extensions as you like ;)
AddType MIME-type extension [extension] ...
this tells apache that whenever it hits a file with the extension extension it should treat the file as mimetype MIME-type. So it will search for a handler that will serve MIME-type.
mod_php registered itself as handler for application/x-httpd-php

Posted: Sun May 25, 2003 7:38 am
by adneg
There is something not right here.

I added the line and I now get 500 internal server error. Just when I think I am getting there.

I wish this was simple!!

Posted: Sun May 25, 2003 9:18 am
by volka
only replace
AddType application/x-httpd-php .php
by

Code: Select all

AddType application/x-httpd-php .php .osp
in your httpd.conf

Posted: Sun Jun 29, 2003 7:30 am
by adneg
I finally got round to doing that. The php code is now being read but, i get the 404 not found page.

I am getting there but slowly.

Posted: Sun Jun 29, 2003 4:57 pm
by qartis
Create test.osp, and fill it with

Code: Select all

<?php
$foo = "bar";
echo $foo;
?>

And call that script directly from a browser. Post the output here.