0

I'm using Fedora 23 and I have installed apache and php using dnf. Opening localhost on browser shows Fedora Test Page of Apache, so Apache is working.

After install php, I don't know why but none of php settings were in httpd.conf, so following this answer: https://stackoverflow.com/a/5121589/4701452 adapting to Fedora with this

http://ahmed.amayem.com/enabling-php-in-apache-on-linux-centos-6-by-loading-the-module-in-httpd-conf/ and this

http://tech.amikelive.com/node-369/quick-tip-how-to-install-and-configure-php-in-fedora-linux/

I've added the following to my httpd.conf:

LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php
DirectoryIndex index.html index.php

I've restarted apache and when I open a script with:

<?php
    phpinfo();
?>

It still doesn't work. In Chrome it shows the script code in Firefox it shows nothing.

PHP is recognized by php -v

And when executed by terminal: php -r "phpinfo();"

It shows lots of information as it was suppose to do in the script:

PHP Version => 5.6.29
System => Linux localhost.localdomain 4.8.15-200.fc24.x86_64 #1 SMP Thu Dec 15 23:09:22 UTC 2016 x86_64
Build Date => Dec 8 2016 09:17:06Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /etc/php.ini
Scan this dir for additional .ini files => /etc/php.d
Additional .ini files parsed => /etc/php.d/20-bz2.ini,
[AND MUCH MORE INFORMATION...]

Community
  • 1
  • 1

1 Answers1

0

try disabling SElinux

so this is not the recommended way of doing this, but it should work. worked for me.

vim /etc/selinux/config

and set

SELINUX=disabled

and restart.

it should work though, you should read up on selinux because it's super interesting.

PS. also, you shouldn't have to add anything to your httpd.conf file

GeneralCan
  • 305
  • 6
  • 18