1

I'm new in linux system. I've problem with executing php code in browser.

  • I've installed all packages, by using this command

    sudo apt install apache2 php libapache2-mod-php

  • Add user to the root group

  • When I type php -V in command line it works, and http://localhost page in browser also works.

But when I try to execute php file it shows as a text instead of executing.

apache2 not executing php code

So how can I solve this problem ?

Any help is appreciated. Thank you!

1 Answers1

1

You can write a bash script start.sh with following content:

 #!/bin/bash
 php -f somefile.php

Then start from command line /path/start.sh

Or you can write a Startphp.desktop file with this content:

[Desktop Entry]
Encoding=UTF-8
Name=Start php
Comment=Start PHP
Type=Application
Exec=/path/to/php /path/to/somefile.php
Icon=/path/to/your/icon.png
Name[fr_FR]=Start PHP
Categories=

Then start with double click on the desktop file in the file manager.

kukulo
  • 2,015