Home > Mobile >  How to include PHP in a HTML (CSS,JS) website?
How to include PHP in a HTML (CSS,JS) website?

Time:12-24

So I need to make a contact form for my website with PHP. Why PHP? My dad said that our webhost only works with PHP and not Node.js or something else.

So I downloaded XAMPP and started the Apache server, googled localhost:80 and my website was shown. All good. I added the directory of my HTML, CSS, JS files to DocumentRoot and Directory in httpd.conf. Was that the right thing?

Then I looked at how to integrate PHP with Apache. Then I found out that I have to add this in httpd.conf.

LoadModule php_module "c:/php/php8apache2_4.dll"
<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>
PHPIniDir "C:/php"

But that didnt work for me because I couldnt start my apache server anymore.

The error log said that something was wrong in apache/htdocs/api.

I tried to find this directory and couldnt find api in htdocs. So now Im kinda overwhelmed.

Does anyone know what to do?

CodePudding user response:

If you download XAMPP then it's already set up with php. You don't have to install php manually.

  • Related