cPanel migrate sub-domain fcgi to php-fpm error

SYSTEM INFORMATION
OS type and version AlmaLinux 9.2
Webmin version 2.101
Virtualmin version 7.8.2
Related packages PHP-FPM

Hello

I am migrating cPanel accounts into virtualmin but hitting issues due to my existing php setup on cPanel. When migrating the cPanel account with sub-domains, the main domain is assigned PHP-FPM correctly but the sub-domains are somehow has an issue and I am not able to switch my php version or even save the same version and get the following error when I try to do it:

Failed to save PHP options : Failed to open /home/assets/public_html/demo/cgi-bin/php8.0.cgi.webmintmp.287525 : No such file or directory

I am trying to switch to PHP 7.4 which I have available but this seems to be not working at all.

Can someone please help?

Try switching to a different execution mode (or disabling PHP entirely if you don’t have any other execution modes) and then to PHP-FPM. It looks like it’s trying to use a CGI-based mode, which may be a bit weird on Alma (which doesn’t have suexec available, and so the non-PHP-FPM execution modes are a bit weird and quite different from older systems). A migration should have done the right things, and it’s a bug that it didn’t, but you can maybe convince it to do the right things now.

Thank you Joe for helping.

I have already tried to disable php all together then enable again. But disabling processes fine however the only available option PHP-FPM still fails even with the same php version. So a bit stuck now.

Hmm…can the β€œSub-domain” be upgraded to a β€œSub-server”? (I don’t know, as I haven’t seen a system with the Sub-domain type enabled in many years, it only happens when you import Sub-domains from cPanel.)

The Sub-domain type is completely hidden for 90+% of users, and so it doesn’t get nearly as much testing or bug reports. I don’t know if it’s possible to go from sub-domain to a sub-server, but if it were, you’d be in better-trod territory.

I’ll ask @Jamie to take a look at this thread and see if he has any other thoughts about what might be going wrong here and how to get you unstuck.

The 7.4 version has to be install to be able to switch to it.
https://www.virtualmin.com/documentation/web/multiplephp/

sub-domain don’t really exist anymore in the latest cpanel, only domains.

Are you on a older version

Not sure if that effects the import process.

I have a large number of sub-domains, so can’t do them manually. I am using 7.4 PHP, although for some reason during migrate it always chooses PHP 8 even though I have selected 7.4 in the default and subdomain templates.

I would like to keep subdomains as sub servers to maintain same user and properties. It’s Easton manage this way.

Looking forward to your help please.

Sub-domains and Sub-servers are different things. Normally, Sub-domains are a hidden type in Virtualmin (because they’re a terrible idea that we allowed cPanel users to talk us into), and you only get them in Virtualmin by migrating Sub-domains from cPanel backups.

Both Sub-domains and Sub-servers are owned by their parent Virtual Server. The difference is in how the files are laid out, and the limitations of Sub-domains. Sub-domains web root is inside the parent’s public_html (which is a terrible place for it).

Sub-domains are not easier to manage than Sub-servers, and they share the same ownership model, they’re just laid out differently (and very dumbly, IMHO) and they can’t have a bunch of features that Sub-servers can have (but since you’re migrating you probably don’t care about the features they can’t have).

Yes I really like the idea of sub-servers because folder separation is available by default but the same unix user and account is there. So it makes sense and it’s efficient then cPanel shared public_html model.

I am running a web application with a separate instance of the app in every subdomain but they share external libraries and log generation. So it is an ideal setup for me in this design and of course cPanel migration is a must for me as I have large amount of subdomains to migrate unfortunately.

Hopefully you guys will be able to find a workaround for me.

Seems like something went wrong with the creation of /home/assets/public_html/demo/cgi-bin during the cPanel migration. I assume that directory doesn’t exist? But does /home/assets/public_html/demo exist?

At first I thought I may have understood the issue, I was supplying administrator account name which I thought was different than what is in the cPanel backup. So I ran another migration, leaving the administrator username as default. Unfortunately that also did the same thing.

cPanel original structure:
My subdomains public_html files are under microsub folder structure below within the main domain public_html files (standard in cPanel). Only admin subdomain folder is at the root of public_html and seems to have worked fine with virtualmin migration.

/home/assetsdash/public_html
[assetsdash@server public_html]$ tree -d -L 2
.
β”œβ”€β”€ admin
β”‚   β”œβ”€β”€ account
β”‚   β”œβ”€β”€ backup
β”‚   β”œβ”€β”€ cgi-bin
β”‚   β”œβ”€β”€ common
β”‚   └── final
β”œβ”€β”€ cgi-bin
β”œβ”€β”€ main
β”‚   β”œβ”€β”€ assets
β”‚   β”œβ”€β”€ backup
β”‚   └── common
└── microsub
    β”œβ”€β”€ demo
    β”œβ”€β”€ dev
    β”œβ”€β”€ harv
    β”œβ”€β”€ micro_libraries
    └── misc
17 directories
[assetsdash@server public_html]$ ls -lrth cgi-bin/
total 0
[assetsdash@server public_html]$ ls -rlth admin/cgi-bin/
total 0
[assetsdash@server public_html]$ ls -lrth microsub/*/cgi-bin/
microsub/dev/cgi-bin/:
total 0
microsub/harv/cgi-bin/:
total 0
microsub/demo/cgi-bin/:
total 0

virtualmin migration main server structure
All files are copied okay in the main public_html folder

[assetsdash@vmi1482067 public_html]$ tree -d -L 2
.
β”œβ”€β”€ admin
β”‚ β”œβ”€β”€ account
β”‚ β”œβ”€β”€ backup
β”‚ β”œβ”€β”€ cgi-bin
β”‚ β”œβ”€β”€ common
β”‚ └── final
β”œβ”€β”€ cgi-bin
β”œβ”€β”€ main
β”‚ β”œβ”€β”€ assets
β”‚ β”œβ”€β”€ backup
β”‚ └── common
└── microsub
    β”œβ”€β”€ demo
    β”œβ”€β”€ dev
    β”œβ”€β”€ harv
    β”œβ”€β”€ micro_libraries
    └── misc
17 directories
[assetsdash@vmi1482067 public_html]$ ls -lrth cgi-bin/
total 8.0K
-rwxr-xr-x 1 assetsdash assetsdash 84 Oct 14 21:30 php8.0.cgi
-rwxr-xr-x 1 assetsdash assetsdash 146 Oct 14 21:30 php7.4.cgi
[assetsdash@vmi1482067 public_html]$ ls -lrth admin/cgi-bin/
total 8.0K
-rwxr-xr-x 1 assetsdash assetsdash 84 Oct 14 21:31 php8.0.cgi
-rwxr-xr-x 1 assetsdash assetsdash 146 Oct 14 21:31 php7.4.cgi
[assetsdash@vmi1482067 public_html]$ ls -lrth microsub/*/cgi-bin/
microsub/dev/cgi-bin/:
total 0
microsub/harv/cgi-bin/:
total 0
microsub/demo/cgi-bin/:
total 0

virtualmin migration subdomains/sub-server structure
However sub-server structure is missing public_html folder and all relevant files as well

/home/assetsdash/domains
[assetsdash@vmi1482067 domains]$ tree -d -L 2
.
β”œβ”€β”€ admin.<hiding domain name on purpose>
β”‚ β”œβ”€β”€ bin
β”‚ β”œβ”€β”€ etc
β”‚ β”œβ”€β”€ homes
β”‚ β”œβ”€β”€ logs
β”‚ └── tmp
β”œβ”€β”€ demo.<hiding domain name on purpose>
β”‚ β”œβ”€β”€ etc
β”‚ β”œβ”€β”€ homes
β”‚ β”œβ”€β”€ logs
β”‚ └── tmp
β”œβ”€β”€ dev.<hiding domain name on purpose>
β”‚ β”œβ”€β”€ etc
β”‚ β”œβ”€β”€ homes
β”‚ β”œβ”€β”€ logs
β”‚ └── tmp
└── harv.<hiding domain name on purpose>
    β”œβ”€β”€ etc
    β”œβ”€β”€ homes
    β”œβ”€β”€ logs
    └── tmp
21 directories

virtualmin migration output

Validating migration file ..
.. done
Starting migration of <hiding domain name on purpose> from local file /home/harvinder/assetsdash.tar.gz ..
Checking for cPanel features ..
.. found Home directory, Administration user, Apache website, Log file rotation, Webmin login, DNS domain, MariaDB database .
However, the follow features are not supported or enabled on your system : Mail for domain, Webalizer reporting. Some functions of the migrated virtual server may not work.
Checking for clashes and dependencies ..
.. all OK
Creating initial virtual server <hiding domain name on purpose> ..
Creating administration group assetsdash ..
.. done
Creating administration user assetsdash ..
.. done
Adding administration user to groups ..
.. done
Creating home directory ..
.. done
Creating mailbox for administration user ..
.. done
Adding new DNS zone ..
.. done
Adding new virtual website ..
.. done
Starting FCGIwrap server ..
.. failed : /home/assetsdash/public_html/cgi-bin not found
Adding webserver user apache to server's group ..
.. done
Performing other Apache configuration ..
.. done
Setting up log file rotation ..
.. done
Creating MariaDB login ..
.. done
Creating Webmin user ..
.. don
Saving server details ..
.. done
Re-starting DNS server ..
.. done
Applying webserver configuration ..
.. done
Restarting PHP-FPM 8.0 server ..
.. done
Re-loading Webmin ..
.. done
Updating Webmin user ..
.. done
Re-loading Webmin ..
.. done
.. done
Copying home directory to /home/assetsdash ..
.. done
Fixing home directory permissions ..
.. done
Moving server owner's mailbox ..
.. done
Copying Cron jobs ..
.. done
Re-creating and loading MySQL databases ..
Creating MariaDB database assetsda_clients ..
.. done
Creating MariaDB database assetsda_demo ..
.. done
Creating MariaDB database assetsda_dev ..
.. done
Creating MariaDB database assetsda_harv ..
.. done
.. done (created 4 databases)
Re-creating MySQL users ..
.. done (created 4 MySQL users)
Re-creating FTP users ..
.. done (created 0 FTP users)
Creating sub-domain admin.<hiding domain name on purpose> ..
Creating home directory ..
.. done
Adding records to DNS zone <hiding domain name on purpose> ..
.. done
Adding to email domains list ..
.. done
Adding new virtual website ..
.. done
Starting FCGIwrap server ..
.. failed : /home/assetsdash/public_html/admin/cgi-bin not found
Performing other Apache configuration ..
.. done
Saving server details .
.. done
Applying webserver configuration ..
.. done
Restarting PHP-FPM 8.0 server ..
.. done
Re-starting DNS server ..
.. done
Updating Webmin user ..
.. done
Re-loading Webmin ..
.. done
.. done
Creating sub-domain dev.<hiding domain name on purpose> ..
Creating home directory ..
.. done
Adding records to DNS zone <hiding domain name on purpose> ..
.. done
Adding to email domains list ..
.. done
Adding new virtual website ..
.. done
Starting FCGIwrap server ..
.. failed : /home/assetsdash/public_html/dev/cgi-bin not found
Performing other Apache configuration ..
.. done
Saving server details ..
.. done
Re-starting DNS server ..
.. done
Applying webserver configuration ..
.. done
Restarting PHP-FPM 8.0 server ..
.. done
Updating Webmin user ..
.. done
Re-loading Webmin ..
.. done
.. done
Creating sub-domain demo.<hiding domain name on purpose> ..
Creating home directory ..
.. done
Adding records to DNS zone <hiding domain name on purpose> ..
.. done
Adding to email domains list ..
.. done
Adding new virtual website ..
.. done
Starting FCGIwrap server ..
.. failed : /home/assetsdash/public_html/demo/cgi-bin not found
Performing other Apache configuration ..
.. done
Saving server details ..
.. done
Re-starting DNS server ..
.. done
Applying webserver configuration ..
.. done
Restarting PHP-FPM 8.0 server ..
.. done
Updating Webmin user ..
.. done
Re-loading Webmin ..
.. done
.. done
Creating sub-domain harv.<hiding domain name on purpose> ..
Creating home directory ..
.. done
Adding records to DNS zone <hiding domain name on purpose> ..
.. done
Adding to email domains list ..
.. done
Adding new virtual website ..
.. done
Starting FCGIwrap server ..
.. failed : /home/assetsdash/public_html/harv/cgi-bin not found
Performing other Apache configuration ..
.. done
Saving server details ..
.. done
Re-starting DNS server ..
.. done
Applying webserver configuration ..
.. done
Restarting PHP-FPM 8.0 server ..
.. done
Updating Webmin user ..
.. done
Re-loading Webmin ..
.. done
.. done
Successfully migrated <hiding domain name on purpose> virtual server, click here to manage it.

Further logs

Updating PHP to 7.4 for sub-server demo

Updating PHP directory /home/assetsdash/public_html/microsub/demo to version 7.4 ..
 Fatal Error!
Failed to save PHP options : Failed to open /home/assetsdash/public_html/demo/cgi-bin/php8.0.cgi.webmintmp.334705 : No such file or directory 

Updating PHP to 7.4 for sub-server admin

Updating PHP directory /home/assetsdash/public_html/admin to version 7.4 ..
.. done
Updating Webmin user ..
.. done
Restarting PHP-FPM 7.4 server ..
.. done
Applying webserver configuration ..
.. done
Re-loading Webmin ..
.. done

For some reason even though each subdomain has a separate home directory, it seems to me that somehow they are still all connected to the original cPanel directory structure for the subdomains under the main domain’s public_html folder. This seems quite weird, I am not sure what to make of it. Are my files for each of the sub-servers are are still managed through the main domain location as it was in cPanel layout?

/home/assetsdash/domains
[assetsdash@vmi1482067 domains]$ tree -L 3
.
β”œβ”€β”€ admin.assetsdashboard.com
β”‚   β”œβ”€β”€ bin
β”‚   β”‚   └── php -> /bin/php74
β”‚   β”œβ”€β”€ etc
β”‚   β”‚   β”œβ”€β”€ php7.4
β”‚   β”‚   β”œβ”€β”€ php8.0
β”‚   β”‚   └── php.ini -> php7.4/php.ini
β”‚   β”œβ”€β”€ homes
β”‚   β”œβ”€β”€ logs
β”‚   β”‚   β”œβ”€β”€ fcgiwrap.log
β”‚   β”‚   └── php_log
β”‚   └── tmp
β”œβ”€β”€ demo.assetsdashboard.com
β”‚   β”œβ”€β”€ etc
β”‚   β”‚   β”œβ”€β”€ php7.4
β”‚   β”‚   β”œβ”€β”€ php8.0
β”‚   β”‚   └── php.ini -> php8.0/php.ini
β”‚   β”œβ”€β”€ homes
β”‚   β”œβ”€β”€ logs
β”‚   β”‚   β”œβ”€β”€ fcgiwrap.log
β”‚   β”‚   └── php_log
β”‚   └── tmp
β”œβ”€β”€ dev.assetsdashboard.com
β”‚   β”œβ”€β”€ etc
β”‚   β”‚   β”œβ”€β”€ php7.4
β”‚   β”‚   β”œβ”€β”€ php8.0
β”‚   β”‚   └── php.ini -> php8.0/php.ini
β”‚   β”œβ”€β”€ homes
β”‚   β”œβ”€β”€ logs
β”‚   β”‚   β”œβ”€β”€ fcgiwrap.log
β”‚   β”‚   └── php_log
β”‚   └── tmp
└── harv.assetsdashboard.com
    β”œβ”€β”€ etc
    β”‚   β”œβ”€β”€ php7.4
    β”‚   β”œβ”€β”€ php8.0
    β”‚   └── php.ini -> php8.0/php.ini
    β”œβ”€β”€ homes
    β”œβ”€β”€ logs
    β”‚   β”œβ”€β”€ fcgiwrap.log
    β”‚   └── php_log
    └── tmp

29 directories, 13 files

I have further done some testing and started to understand what you meant by saying sub-server is the not the same as sub-domain. Virtualmin is basically mimicking the idea of subdomains as cPanel to ease migration, which makes sense. However the added confusion is what those new folders under domains are meant for?

It looks like the subdomain folder is only compatible to be under /home/user/public_html/subdomain and because my subdomain folder was under another folder i.e. /home/user/public_html/microsub/subdomain the php module was failing to switch it, because it seems that the folder structure is hardcoded somewhere instead of taking it from the server root settings instead.

What I had to change to get the PHP assignment working:

  1. Went into Server Configuration β†’ Website Options
  2. Updated Website document sub-directory
    • It was set to: /home/assetsdash/public_html/microsub/demo
    • Changed it to public_html/demo
  3. I also moved the subdomain folder in the filesystem as well
    • Moved /home/assetsdash/public_html/microsub/demo
    • To /home/assetsdash/public_html/demo
  4. Performed PHP version change and it worked okay
    • Seems like the PHP module has some level of hardcoding to generate document root instead of reading from the website configuration
    • I would have preferred my subdomain folder to remain under the original folder i.e. public_html/microsub/demo but not sure how I can achieve this

However now I am in another problem, which I think was already present as well. When I open this subdomain website through Preview Website link, I get 403 Forbidden page. Should I open a new post to manage this issue?

Thank you once again for looking into this for me.

While looking at the cPanel migration process and the problems it is showing so far. It feels like it is better to instead migrating manually and making use of sub-servers instead of subdomains setup to make it compatible with virtualmin setup.

Unless @Joe / @Jamie fix these issues please? And maybe have a choice to convert subdomains to sub-servers as part of migration which I think would be better.

So, the simplest fix is probably just fixing whatever is going wrong with setting up PHP in subdomains.

It’s entirely possible that converting from a sub-domain to a sub-server is a non-trivial task; certainly it’d need to update paths and such in the Apache config (though it generally has to do that anyway). Migrations from other control panels in general are pretty fraught, as the backup formats are undocumented and change over time. I think we’d probably need to see a backup that exhibits the problem (i.e. has a subdomain that fails to have working PHP after migration).

Yes that makes sense.

I can create an example cPanel backup file for you to reproduce the error for you. I will get that over to you in the next couple of days.

1 Like

Thanks, a sample backup to re-produce this issue would be super useful!

@Joe / @Jamie - I have pinged you the location of cPanel backup directly for privacy purposes. You can reproduce the error with this backup. What I have observed:

  • When updating PHP Option, it expects the subdomain folder in this format: /home/user/public_html/<subdomain named folder only, should not contain main domain in the name>
  • Any other location or naming convention used for the subdomain folder, makes the process fail as seen below

Failed to save PHP options : Failed to open /home/cpmigtest/public_html/top/cgi-bin/php8.0.cgi.webmintmp.62470 : No such file or directory

Failed to save PHP options : Failed to open /home/cpmigtest/public_html/sub2/cgi-bin/php8.0.cgi.webmintmp.61916 : No such file or directory

Hope this helps, and hopefully you can fix this issue.

Ok, I see the bug now … this will be fixed in the next release of Virtualmin.

Any timeline please?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.