Reputation: 37
Could someone help me configure my httpd.conf
server file so I can execute simple php code run as .html file?
The browser outputs nothing or is just blank. (ex. )
php version - 7.2.8 server version - Apache/2.4.34 (Fedora)
Upvotes: 1
Views: 2228
Reputation: 520
Create .htaccess file in your project directory and use below code:
RewriteEngine On
RewriteRule index.html index.php
replace index with your script file name
Upvotes: 1
Reputation: 452
you should save your html file with php Format or Using .htaccess to make all .html pages to run as .php files :
First way:
file.html most convert to file.php
you most Run your web service and then open your file with logical address http://localhost/file.php
Secund Way: Create a .htaccess file at the root of your website and add this line:
[Apache2 @ Ubuntu/Debian: use this directive]
AddType application/x-httpd-php .html .htm
Or, from comment below:
AddType application/x-httpd-php5 .html .htm
If your are running PHP as CGI (probably not the case), you should write instead:
AddHandler application/x-httpd-php .html .htm
Using .htaccess to make all .html pages to run as .php files
Upvotes: 0