Php file not executed

Hello guys,

I am actualy trying to use PHPmailer in my hugo website.
I have downloaded a theme. In the theme there is a mailer.php file that is using PHPmailer.

The things is that there is smtp variables to modify in the mailer.php file that is into the template.

So i am moving this file into my static folder and i am updated it.

But when I do a post request unsing JS to pass the data to the php file that is in my static folder it return the php file itself.

I am knew to hugo so let me know if you need more informations.

Thanks in advance.

My folder structure -
static/js/custom-script.js (where my post is)

Your webserver has to be configured to use PHP. Otherwise it treats it like the text file it is and serves it.

You’ll need to discuss this with your hosting provider. :slight_smile:

Hello maiki thank you for your answer ! I am using it in local host like this hugo server how can I configure hugo server to use PHP ? thank you !

The hugo server web server is likely not meant to serve php. Deploy the site to a real web server, then try it there.

Thank you RickCogley on my way to do that !