Page 1 of 1

xampp behaviour with .php files on Linux Manjaro

PostPosted: 17. August 2020 13:36
by AlinP
Hi guys,

Newbie here. I just installed xampp 7.4.8 on my Manjaro Linux kernel version 5.4.52-1.
When I try and start xampp it seems to be working. Please see terminal output below:

$ sudo /opt/lampp/lampp start

Starting XAMPP for Linux 7.4.8-0...
XAMPP: Starting Apache...ok.
XAMPP: Starting MySQL...ok.
XAMPP: Starting ProFTPD...ok.

Also, when i type localhost in my Chromium browser I also seem to be ok and I can navigate to myphpadmin.

The problem occurs when I try to run a .php file. I am a complete beginner at web development and I created a file called index.php and aiming to print some text on the screen. Well, instead of executing the file and displaying the text on the screen my browser downloads a copy of the file in my Downloads folder.

Terminal output:
$ chromium index.php
Opening in existing browser session.

Screen printout below:
Image

Re: xampp behaviour with .php files on Linux Manjaro

PostPosted: 17. August 2020 18:29
by Altrea
AlinP wrote:Terminal output:
$ chromium index.php
Opening in existing browser session.


You cannot open plain .php files in your browser (unlike .html files which can successfully be opened directly in your browser).
PHP is a serverside programming language, so it needs to get processed by an php interpreter on your server.
You need to request a .php file by url (e.g. http://localhost/file.php , path is dependend on the save path inside your htdocs)