How to run php files


(Justin Kringstad) #1

i’m trying to run a php forum software -Xenforo. but it requires php. how do you do this with caddy server? every time i try to install PhP7.2 it wants to install Apache as well.


(Marcus Cemes) #2

As another user of Caddy, I would suggest going down the CGI or FastCGI path.

PHP must be built/installed with CGI capability, I don’t believe there is a plugin to just add PHP.
There is a fantastic example of a simple CGI setup at the CGI plugin’s documentation: https://jung-kurt.github.io/cgi/

The idea is that when loading dynamic content, such as a .php file, it will run it through the PHP preprocessor. PHP also have guides on how to get set up using their CGI version.


(Magikstm) #3

What OS are you using?

You may need to build it yourself as suggested by @MarcusCemes, may need to download it from an alternative repo such as EPEL or may need to download it from php.net depending on your OS.

Related Caddy docs: https://caddyserver.com/docs/fastcgi