After setting up Apache it's not serving PHP files, but showing the contents of the files instead

After setting up Apache it's not serving PHP files, but showing the contents of the files instead

The error I got is in this url: url in browser: http://localhost/ error in browser: https://justpaste.it/d82bd

What am I missing here?

I copied the file ipconfig.php (given below) from ipconfig.php.example but no luck.

I give permission to the files using this:


cat /etc/systemd/system/php-fpm.service.d/override.conf

ReadWritePaths = /srv/http/ipconfig.php
ReadWritePaths = /srv/http/uploads/
ReadWritePaths = /srv/http/application/logs
ReadWritePaths = /srv/http/vendor/mpdf/mpdf/tmp

 $ ls /srv/http

 application     docker-compose.yml  ipconfig.php.example  uploads
 assets          Gruntfile.js        LICENSE.txt       v1.5.11.zip
 composer.json   htaccess        package.json      vendor
 composer.lock   index.php       README.md
 CONTRIBUTING.md  ipconfig.php       robots.txt

We are on Archlinux

We created a database in mariads as explained in Archwiki

$ mariadb -u root -pa
MariaDB > CREATE DATABASE invoiceplane;
MariaDB > GRANT ALL PRIVILEGES ON invoiceplane.* TO invoiceplane@'localhost' IDENTIFIED BY 'password';
MariaDB > FLUSH PRIVILEGES;

further

$ cat /etc/httpd/conf/extra/invoiceplane.conf
Alias /invoiceplane "/srv/http"
<Directory "/srv/http">
    DirectoryIndex index.php
    AllowOverride All
    Options FollowSymlinks
    Require all granted
</Directory>
$ cat /etc/httpd/conf/httpd.conf

result

$cat /srv/http/ipconfig.php

result

I am sorry but I am a complete newbie but I tried to do as suggested in wiki and docs.

답변1

I would do a Google search with the following keywords: apache server not reading php files

It will show that you need to add a handler for PHP files in the Apache config file

답변2

the "error" you pasted in justpaste.it is not a real error message, but you are seeing the whole index.php file. This means probably that PHP on your server is misconfigured.

관련 정보