xampp/linux-x86_64 php file trying to download

Problems with the Linux version of XAMPP, questions, comments, and anything related.

xampp/linux-x86_64 php file trying to download

Postby pserru » 08. September 2011 15:40

Hello everybody,
The subject is very near the one of viewtopic.php?f=1&t=42342&p=166869&hilit=php+rendering#p166869 because my problem is the same, that is: "... when I save a file with a .php extention and try to open it in browser, rather than rendering the download sheild appears. Have checked and rechecked my Apache ..."

Here is the files organisation:
Code: Select all
  +/opt/lampp/htdocs/
  | +----- webalizer/
  | +----- www.site.net/
    | ----- index.html
    | ----- index.php
    | ----- other files
    | +---- other directories/
  | +----- xampp/
  | ------ ~favicon.ico
  | ------ ~index.php

So typing in the URL part of the browser "http://hostname/xampp/" works fine, including "http://hostname/xampp/phpinfo.php". Typing "http://hostname/www.site.net/" renders the content of the file "index.html", but on typing "http://hostname/www.site.net/index.php", the browser opens a dialog-box...
I realy dont understand and I feel stupid, the contents of xampp being correctly displayed...
Thank you for reading this post,
Patrick
pserru
 
Posts: 7
Joined: 08. September 2011 14:31

Re: xampp/linux-x86_64 php file trying to download

Postby JonB » 08. September 2011 18:25

Well, did you create a Virtual Host?

:shock:
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: xampp/linux-x86_64 php file trying to download

Postby pserru » 11. September 2011 04:07

Hello JonB,

Thank you for your answer. I did not respond quicker because I was installing kubuntu 10.10 Trinity Enterprise. I did so because I was beliving that my Suse 10.3 was in bad state, because stopping Xampp, my browser was still displaying something at localhost! All the packages had been removed with Yast! Then, I removed all tle files related to apache in /etc/rc.d/ but I dont remember the effect...

Now (with Trinity), its OK: the browser says that there is no connection (La connexion a échoué) when Xampp is stopped. But starting, it says: "XAMPP: Couldn't start MySQL!" :-/ No matter, for the moment, I dont nead MySQL. I will install some APT package later.

But the broblem is still here: Typing "http://hostname/www.site.net/" renders the content of the file "index.html", but on typing "http://hostname/www.site.net/index.php", the browser still opens a dialog-box...

The file "/opt/lampp/etc/extra/httpd-vhosts.conf" is the original. If I well understand, there are two virtual hosts defined there. I just hope that Lampp-Apache does not evaluate a file called /opt/lampp/etc/extra/httpd-vhosts.conf~, for the rest, all are original files!

Already crazy or not, I'm going deeper in madness...

Sincerly,
Patrick
pserru
 
Posts: 7
Joined: 08. September 2011 14:31

Re: xampp/linux-x86_64 php file trying to download

Postby JonB » 11. September 2011 13:28

Two things -

1. - those virtual hosts are not active as they are commented out.

2. - My guess at this moment is you have not grokked the XAMPP/LAMPP FAQ's -
http://www.apachefriends.org/en/xampp-linux.html
XAMPP is NOT a standard Linux LAMP Stack. Many assumptions about it's behavior, or how things proceed will not work out if you expect it to work with standard Linux directives or tools. In fact, to start it properly, you must use terminal, with su or sudo, then issue this command "/opt/lampp/lampp start"

Good Luck
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: xampp/linux-x86_64 php file trying to download

Postby pserru » 11. September 2011 14:51

Hello JonB, and thank you for this answer,

I dont understand your answer because:
  • 1- in the original file xampp-linux-1.7.4.tar.gz, the virtual hosts definition are not commented out, and
  • 2- if you try to issue the command "/opt/lampp/lampp start" without the rights of root, lamp tells you that it needs it to start ("You need to start XAMPP as root!").

Here is the contents of the file "/opt/lampp/etc/extra/httpd-vhosts.conf", with removed comments:
Code: Select all
NameVirtualHost *:80
<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot /www/docs/dummy-host.example.com
    ServerName dummy-host.example.com
    ServerAlias www.dummy-host.example.com
    ErrorLog logs/dummy-host.example.com-error_log
    CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot /www/docs/dummy-host2.example.com
    ServerName dummy-host2.example.com
    ErrorLog logs/dummy-host2.example.com-error_log
    CustomLog logs/dummy-host2.example.com-access_log common
</VirtualHost>


The reason why it does not work correctly is certainly a big mistake, but I dont see it...

Sincerly,
Patrick
pserru
 
Posts: 7
Joined: 08. September 2011 14:31

Re: xampp/linux-x86_64 php file trying to download

Postby JonB » 11. September 2011 16:12

OK -

A. You are right about the vhosts example - it is nor commented out - (as it is in other versions of XAMPP)
BUT those directives will not execute because -

The only .conf file in /opt/lampp/etc/extra that WILL be included is

Code: Select all
# XAMPP
Include etc/extra/httpd-xampp.conf


(that is from the /etc/httpd.conf file)
AND
etc/extra/httpd-xampp.conf does not contain any 'includes'.

So XAMPP/LAMPP will not execute /etc/extra/httpd-vhosts.conf

If you wanted some vhosts - the thing to do would be to modify the vhosts example (you normally need two, one to 'contain' the default server, and a second for the first 'named host') THEN you would chain the /etc/extra/httpd-vhosts.conf into the /etc/httpd.conf file with another 'include' directive.
http://httpd.apache.org/docs/2.2/mod/core.html#include

After looking at your first post - I think you need a vhost (a site should not be nested in another server's web space, as it inherits any recursive directives) Generally - vhosts are 'parallel' with the actual server space. (you can actually put them anywhere you want as long as the ownership and permissions are correct - it just gets confusing)

/opt/lampp/
/opt/lampp/htdocs
/opt/lampp/vhost1
/opt/lampp/vhost2
....

About starting LAMPP-

you must use terminal, with su or sudo, then issue this command


su or sudo will make you the superuser (root) or an equivalent. On most SE Linux installs, you can't login is as root. If you can login as root, then all is well.

You know, I'm glad i wrote this - you also might be impeded by SE Linux (possible, but not all that likely).

Get the SE Linux status:

#cat /etc/sysconfig/selinux

or

#sestatus

To disable -

http://www.thegeekstuff.com/2009/06/how ... bian-unix/

Or of course Google 'disable SE Linux'. if that's not to your taste.

If you are not a penguin head, the most straight forward approach is to edit the config and re-boot. You, of course, will need to be logged in as root, OR use su or sudo (with the correct password) to make the changes.


Good Luck
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: xampp/linux-x86_64 php file trying to download

Postby pserru » 12. September 2011 03:49

Hello JonB,

Thank you for the answer, and specialy for the link related to SELinux. Now, I understand why everybody (every new distribution) need the famous "sudo" command... With Trinity, we can use "kdesu /opt/lampp/lampp start", but in that case, I prefere openning a terminal and type "sudo su" once for all.

Was there a prévious version of xlampp where it was reading all the file included in the extra directory ? In a version (of apache ?) there was a directory of "available_things" and a directory of "used_things" and it is reading all the contents of the second one that are indeed symbolic links pointing on the files in the first. Anyway, I falled in the trap of my bad souvenirs! I corrected so the last lines of /opt/lampp/etc/httpd.conf are:
Code: Select all
#Include etc/extra/httpd-xampp.conf
Include etc/extra/httpd-vhosts.conf

and I did not changed the lines «User nobody» and «Group nogroup»

The contents of /opt/lampp/etc/extra/httpd-vhosts.conf is:
Code: Select all
NameVirtualHost *:80
<VirtualHost *:80>
  ServerAdmin postmaster@exemple.lin
  ServerName exemple.lin
  ServerAlias www.exemple.lin
  DocumentRoot /www/exemple.net/www
  <Directory "/www/exemple.net/www">
    Options All
    AllowOverride All
    Order allow,deny
    Allow from All
  </Directory>
  ErrorLog "/opt/lampp/logs/exemple.net/error.log"
  LogLevel debug
  CustomLog "/opt/lampp/logs/exemple.net/access.log" combined
</VirtualHost>

and /etc/hosts: ... 127.0.1.1 lin-locdom http://www.exemple.lin ...

The content of the rirectory /www is:
Code: Select all
  /www/exemple.net/
  +----- www/
  | +---- other directories/
  | ----- index.html
  | ----- index.php
  | ----- other files


The symtoms are style here: "http://www.serru.lin/" renders index.html while "http://www.serru.lin/index.php" opens a dialog box...

Sincerly,
Patrick
pserru
 
Posts: 7
Joined: 08. September 2011 14:31

Re: xampp/linux-x86_64 php file trying to download

Postby JonB » 12. September 2011 14:05

Was there a prévious version of xlampp where it was reading all the file included in the extra directory ?


I have only used XAMMP for linux since 1.7.3, so I don't know the answer.

On the 'basic issue' of why your index.php is not rendering, are there any .htaccess files in the root of this new folder???
/www/exemple.net/www
If there are, that file would override the directives in the vhost file.

And are there any errors logged to this file - "/opt/lampp/logs/exemple.net/error.log"

Also - here's a test:
Rename the index.php in the root of htdocs to some other file name. Then copy the index.php from your vhost test into htdocs and see if it works.

The other thing worth checking is the ownership and permissions for the folder "/www/exemple.net/www"

Good Luck
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: xampp/linux-x86_64 php file trying to download

Postby pserru » 12. September 2011 19:36

Hello JonB,

Thank you for the answer.

The error, (does it look like a bug ?) is that there is a conflict betwin index.html and index.php. I decided to install the standard version of Apache (http://library.linode.com/web-servers/a ... 0-maverick), and hade the same problem... Renaming index.php into an other name.php, the rendering was OK. I did not test with Xampp, but I suppose it's the same!

I dont know how to mark the thread as "solved". Can you do that, please ? Thanks.

Sincerly,
Patrick
pserru
 
Posts: 7
Joined: 08. September 2011 14:31


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 30 guests