How to enable php

anyone know how to enable php? i am trying to make a registration page and it requires php, whenever i open the php page, its getting downloaded, its not running, please help

1 Like

MiaB by default only permits serving static files, with the exception of the pre-configured PHP tools such as Roundcube and Nextcloud.

there must be some way to enable right?

There is an undocumented feature of /home/user-data/www/custom.yaml which allows customizing the nginx configuration for a domain, but you are on your own when using it. However, when used correctly, MiaB updates should not alter the changes.

I haven’t tried using it. My personal preference on this sort of thing is to use a different server. Problems on the mail server are never fun and rarely easy to resolve.

Because this uses nginx you will have to add a file to your website folder in /home/user-data/www/your.domain.conf

Make the file name your.domain.com.conf (Use your real domain here) lol

add inside

  location ~* \.php$ {
    include fastcgi_params;
    fastcgi_pass php-fpm;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $request_filename;
 }

What makes this work?

the line

fastcgi_param SCRIPT_FILENAME $request_filename;

added to the built in nginx config /root/mailinabox/conf/nginx-alldomains.conf

make it

index index.php index.html index.htm;

save file and restart nginx.

also make sure your index list has index.php before the index.html

1 Like