Page 1 of 1

.PHP files not being displated

PostPosted: 17. December 2008 17:27
by Koryo
Greetings

I am hoping someone can help me, i am fairly new to linux and LAMPP (i use XAMPP Portable so only have experience through that)

My system:

OS - Puppy Linux 4.2 + Development module/compiler/thing
LAMPP install directory - /opt/lampp
LAMPP version - 1.6.8a

Ok, i installed the package without a hitch with the instructions on the download page. I have imported my sites database and website directory correctly. whenever i try and view http://localhost/directory/filename.php my browser (be it in firefox or seamonkey) attempts to DOWNLOAD the .php file, and wont view it. by "attempts to download" i mean it gives me the option to download the file or open it in some other application.

I know this should not be the case, Apache starts fine (i can get to the php files in the LAMPP control panel fine), but i can't seem to view my sites files.

Any advice would be greatly appreciated.

Re: .PHP files not being displated

PostPosted: 17. December 2008 23:15
by glitzi85
Sounds like a misconfiguration inside an .htaccess of your Backup. Look inside your folder and post the content of your .htaccess.

glitzi

Re: .PHP files not being displated

PostPosted: 18. December 2008 10:57
by slimi
I had a similar issue a while back which I managed to cure by re-running /opt/lampp/lampp security
maybe it changes something in httpd.conf but it did the trick for me!

Re: .PHP files not being displated

PostPosted: 18. December 2008 11:42
by Koryo
Right, i just re-ran the security script, no problems doing that

Im going to presume you mean the .htaccess in my /localhost/site directory?

in that case all i have in it is this:

#Use PHP5 as dfefault
Add/Handler fcgid-script .php

ErrorDocument 403 /index.html
ErrorDocument 404 /http://www.SITEHERE.com

Thats all i have in it. Im still having the same problem :(

Thank you for the advice so far!

Re: .PHP files not being displated

PostPosted: 18. December 2008 13:21
by Wiedmann
Add/Handler fcgid-script .php

AFAIK, XAMPP does not include the fcgid module?

Re: .PHP files not being displated

PostPosted: 18. December 2008 15:29
by Koryo
Wiedmann wrote:
Add/Handler fcgid-script .php

AFAIK, XAMPP does not include the fcgid module?


so do i just remove that line and it should work then? if not could someone people give me a default .htaccess file i could use please?

Re: .PHP files not being displated

PostPosted: 18. December 2008 16:21
by Wiedmann
so do i just remove that line and it should work then?

Just try ist and report us the result.

if not could someone people give me a default .htaccess file i could use please?

There is no "default .htacces"s file, because you don't need any .htaccess file for a working Apache server. You only need such a file, if you want change the server configuration.

Re: .PHP files not being displated

PostPosted: 18. December 2008 17:28
by Koryo
Wiedmann wrote:
so do i just remove that line and it should work then?

Just try ist and report us the result.

if not could someone people give me a default .htaccess file i could use please?

There is no "default .htacces"s file, because you don't need any .htaccess file for a working Apache server. You only need such a file, if you want change the server configuration.


Ah right! well iv just deleted the .htaccess file, problem solved!

New one - stupid me didn't use the exact directory structure as on my server xD

ah well, il solve that one. Thanks for your help guys its appreciated

Re: .PHP files not being displated

PostPosted: 19. December 2008 19:40
by Koryo
Hmmm, Interesting

It appears that i need to make a directory structure similar to the one on my web server. Is there any way i can change the default location that apache puts "localhost"? id like to set that to the root of my drive so i can create an exact directory structure like my real server is.

Is this possible please

Re: .PHP files not being displated

PostPosted: 22. December 2008 13:12
by glitzi85
Koryo wrote:It appears that i need to make a directory structure similar to the one on my web server.

That's depending on the Scripts used. I always program my scripts relative, so i can move the complete folder wherever i want.

Koryo wrote:Is there any way i can change the default location that apache puts "localhost"? id like to set that to the root of my drive so i can create an exact directory structure like my real server is.

In this case i would suggest the use of virtual hosts. Otherwise the normal XAMPP pages will not work anymore. Open the file /opt/lampp/etc/extra/httpd-vhosts.conf and put in this code:

Code: Select all
NameVirtualHost *:80

<VirtualHost *:80>
  DocumentRoot /opt/lampp/htdocs
  ServerName localhost
</VirtualHost>

<VirtualHost *:80
  DocumentRoot /path/like/on/your/server
  ServerName test.localhost
  <Directory /path/like/on/your/server>
    Order allow,deny
    allow from all
  </Directory>
</VirtualHost>


Then open the file /etc/hosts and add this line:

Code: Select all
127.0.0.1           test.localhost


After restarting your Apache you should be able to access your Server-like folder via http://test.localhost

glitzi

Re: .PHP files not being displated

PostPosted: 28. December 2008 20:38
by priya
I don't have a .htaccess at all and I'm running into this problem too. My index.php starts to get downloaded in the browser instead of getting executed on the server side.

I am running CentOS 64-bit.

Re: .PHP files not being displated

PostPosted: 05. January 2009 18:10
by glitzi85
priya wrote:I don't have a .htaccess at all and I'm running into this problem too. My index.php starts to get downloaded in the browser instead of getting executed on the server side.

How did you determine that you do not have an .htacess?
If you really do not have an .htaccess file, could you please post the content of your index.php?

glitzi

Re: .PHP files not getting executed

PostPosted: 05. January 2009 19:41
by priya
I know there isn't a .htaccess because I did a ls -la and none was shown.

The files are the basic xampp files that come with the installation. The index.html at the top directory says:
<html>
<head>
<meta name="author" content="Kai Oswald Seidler">
<meta http-equiv="refersh" content="0;url=/xampp/">
</head>
<body bgcolor=#ffffff>
</body>
</html>

This takes us to the index.html in xampp subdirectory which (again not modified by me) is:

<?
if(file_get_contents("lang.tmp")=="")
{
header("Location: splash.php");
exit();
}
?>
<html>
<head>
<meta name="author" content="Kai Oswald Seidler">
<meta http-equiv="cache-control" content="no-cache">
<?include("lang/".file_get_contents("lang.tmp").".php"); ?>
<title><?=$TEXT['global-xampp']?> <?include('.version');?></title>

<frameset rows="74,*" marginwidth="0" marginheight="0" frameborder="0" border="0" borderwidth="0">
<frame name="head" src="head.php" scrolling=no>
<frameset cols="150,*" marginwidth="0" marginheight="0" frameborder="0" border="0" borderwidth="0">
<frame name="navi" src="navi.php" scrolling=no>
<frame name="content" src="start.php" marginwidth=20>
</frameset>
</frameset>
</head>
<body bgcolor=#ffffff>
</body>
</html>

I had to type the above since I didn't have cut-and-paste ability for some reason so any typos are mine. But I have downloaded a second copy and diff'd them side-by-side to be sure there are no differences.

When I go to index.html, firefox starts asking what to do with splash.php, navi.php etc and lists them as a PHP file, now knowing how to deal with it. A slight change since this problem started to show up is, earlier it used to say this is of type application/x-httpd-php (I think) and not PHP file. Maybe that had something to do with a firefox update I did recently.

A simple index.php which only contains phpinfo() and some verbiage only shows the verbiage and no phpinfo output.

There should be a simpler way to know if xampp is handling php right.