Edited: This is not a duplicate – other questions suggested are not the same situation. In this case, MOST html files with PHP work, there’s just one file that does not work. Also, all of the answers suggested for the other problem do not solve this problem, as I have mentioned below.
We’re in the middle of a transition from a CentOS 6.1 server to a CentOS 7.5 server. Versions of Apache and PHP are the same across both servers, and files are all the same. However, when I try to access my homepage (named index.html) the PHP is not executed and instead commented out in the html. Every other page on the site executes PHP fine.
- AddType for PHP in .html files is added.
- No short tags are being used.
- Apache is including the same .conf and .htaccess files in both set ups.
- Apache version 2.4.34 on both servers
- Php version is 7.2.10 on both servers
Does anyone have any idea what I could be doing wrong here, or how I could test this? Thanks so much!
2
Answers
Are you sure that php is indeed not working? can you try adding a php echo to top of the page and see if it prints the given test text?
If both configuration files are same and all files are identical, I suspect the problem could be the location of the files and configuration not matching. If your configs are for
/var/some/directory
but on new setup, you moved files to new location which is/var/new/location
, then config files might not work as intended.Is SELinux enabled? If it is and you’re using a non-default directory for your content, you may need to set the context for the custom directory.