I’m currently working on upgrading my server, moving from PHP 7.3 to PHP 8.3 and from Apache 2.4.6 to Apache 2.4.58. The site loads normally using PHP 7.3. However, when I attempt to use PHP 8.3 and Apache 2.4.58/2.4.6, the site doesn’t load, and it seems like Apache is unable to detect the installed PHP.
PHP code is not being executed:
However, when I configure it as follows:
- PHP 7.3 and Apache 2.4.6, it works
- PHP 7.3 and Apache 2.4.58, it works
- PHP 8.3 and Apache 2.4.6, it doesn’t works (Apache can’t read PHP)
- PHP 8.3 and Apache 2.4.58 it doesn’t works (Apache can’t read PHP)
I suspect there might be an issue with PHP 8.3, but I can’t identify the specific problem. (I’m unable to pinpoint the exact problem.) Upon further investigation, I found an error in the apache log:
AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.html,index.php,index.php) found, and server-generated directory index forbidden by Options directive
I’m seeking clarification on two points:
-
If this issue is related to compatibility, which version of Apache is compatible with PHP 8.3? I’ve searched extensively but haven’t found conclusive information.
-
If this problem isn’t about compatibility, could there be an error in my Apache configuration or with the installed PHP modules?
Any insights or guidance on resolving this matter would be greatly appreciated. Thank you!
For additional context:
- apache error_log:
https://pastebin.com/8JnQyTqV
- apache config httpd.conf:
https://pastebin.com/TbxLMekb
- installed yum module:
https://pastebin.com/ePZwZDUZ
- /httpd/conf.modules.d/20-php.conf:
https://pastebin.com/UbwKpMg8
- /httpd/conf.d/php.conf:
https://pastebin.com/QAh1iA17
2
Answers
So I had a similar issue. I tried downgrading Apache then downgrading PHP.
Still had issues executing PHP.
After much searching and trial and error this worked for me.
In httpd.conf, I added the following under the other LoadModule entries:
LoadModule php_module php8apache2_4.dll
PHPIniDir="C:/php"
Then in the MIME section:
<IfModule mime_module>
AddType application/x-httpd-php .php
</IfModule>
Hope this helps.
Please ensure you add below code as it is in httpd.conf(file location: Apache24/conf)
LoadModule php_module php8apache2_4.dll
PHPIniDir C:/php
add below code in MIME module in same file
AddType application/x-httpd-php .php