My php code is not executed when I access the root directory with
http://localhost:8080/sample.html
The code I want to run is:
<?php phpinfo(); ?>
and I tried also the following:
Could it be that some firefox extensions are blocking php-execution?
All I get is the php code exactly like I wrote it.
You're trying to execute PHP in an ".html" file. You have to edit the PHP handler in the apache config to make it process whatever file extension you want it to. Look for "AddType application/x-httpd-php .php" in your Apache configuration file (somewhere like 'wamp/apache/conf/httpd.conf') then just add " .html" after ".php". The line should look like this now:
AddType application/x-httpd-php .php .html
PHP should now execute any code it finds in files with ".php" and ".html" extensions.
Edit: Or as someone suggested above, just rename your file "sample.php" and it'll be processed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With