Deploying php assets to local Apache (XAMPP) Webserver

I love Hogo. I made my own theme for full control.
I made Hugo produce also a php contact form, which obviously I can not test with hugo server.
Therefore I now just use
hugo --config testlocal.toml,base.toml
and the content of the public folder can be seen under localhost:8081
Now for local use the php assets must be copied to the public folder.
How to do that on Windows 10 Pro 64?
Thank you in advance.
Would you use a .bat file? Are there best practices?

Hi. I can explain in a bit more detail. It’s not something directly related to Hugo’s functionality, as I don’k Hugo has any mv like functionality. Hugo can however copy your /static/php files to /public when you publish/build project.

I do not use Apache, but Nginx instead. But I suppose the PHP fpm configuration would be similar to this:

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

Where the DOCUMENT_ROOT is
root /var/www/;

And my PHP files live inside
/var/www/ (for example)

When I build my site with Hugo, it will take the MushroomCalculator.php file from /static/ and put it into /public, so it becomes /var/www/ which is found at localhost:1313/MushroomCalculator.php

So all you need to do in my opinion is set your apache document root to your hugo project folder, configure php-fpm accordingly to run files in your document root.

Configure your XAMP Apache document root to c:\hugo project\directory\here etc.

Then put your php files in /static/php/ or something (you can decide)

I hope that’s not too confusing. It’s just one way of going about it.