PHP pages wont load in centos 7, it shows only the Source Code

piaakit
piaakit used Ask the Experts™
on
after I ran below, my owncloud become like this, any idea how to fix it ?

semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/data'
restorecon '/var/www/html/owncloud/data'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/config'
restorecon '/var/www/html/owncloud/config'
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/owncloud/apps'
restorecon '/var/www/html/owncloud/apps'

setsebool -P httpd_unified 1
setsebool -P httpd_execmem 1


123
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
NerdsOfTechTechnology Scientist
Commented:
That means PHP isn't installed or is not yet configured to parse .php files. Check your httpd.conf file in Apache.

Author

Commented:
Sorry I'm new in centos, just wonder what should I check in http.conf ? Before the index.php could show after I ran those command it won't show anymore its only show the source code instead , any help would be appreciated
Most Valuable Expert 2015
Commented:
Make sure that php is installed and configured for apache:

# which php
# ls -l /etc/httpd/conf.d/php.conf
Should you be charging more for IT Services?

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

NerdsOfTechTechnology Scientist
Commented:
If it ran before, it sounds like you have php installed. Now you might need to fix permissions on the file you are running or its folder (via CHMOD) to make sure OWNER and GROUP are set appropriately for permissions (for example, 644 for files, 600 for include files, and 755 for folders); also, check your .htaccess if there's one in the folder (it might have directives that are making your php not parse).
Most Valuable Expert 2015
Commented:
Also check selinux:

# ls -ldZ /var/www/html/owncloud/data
# ls -lZ /var/www/html/owncloud/data

Check the selinux permissionions and update.

# chcon -R -t httpd_sys_rw_content_t /var/www/html/owncloud/data

Do this for each directory.

Author

Commented:
I remember under the owncloud, I can't find "data" folder, I only see below, any idea why ?

/var/www/HTML/owncloud/config



/var/www/HTML/owncloud/app
NerdsOfTechTechnology Scientist

Commented:
The solutions provided should help fix the primary issue of PHP files not being parsed. As for the secondary question, the OP is urged to post it separately.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial