I'm in the process of moving from cPanel to DA. I had a question regarding PHP version per domain that I can't find the answer to. Here's how it currently works for me in cPanel and would like to replicate this:
1. Default PHP version on the server is 8.1.
2. Main account domain mysite.com has a docroot of /home/mysite/public_html
3. I set mysite.com to use PHP 7.4 in cPanel
- 1. If I visit a phpinfo file at mysite.com/info.php, I see PHP 7.4
- 2. If I SSH to the server, cd to /home/mysite/public_html, and `php -v`, I see PHP 7.4
4. Create a subdomain new.mysite.com, which has a docroot of /home/mysite/domains/new.mysite.com
5. I set new.mysite.com to use PHP 8.3 in cPanel
- 1. If I visit a phpinfo file at mysite.com/info.php, I see PHP 8.3
- 2. If I SSH to the server, cd to /home/mysite/domains/new.mysite.com, and `php -v`, I see PHP 8.3
6. `php -v` in any other directory displays the server default 8.1
So long story short, setting PHP version in cPanel sets it for both apache and CLI.
I have created a similar setup in DA and set the PHP versions exactly as above. While this works perfectly fine for web requests, I find that no matter what directory I'm in while using CLI, the php version is always the server default 8.1.
Does this sound like I've set this up wrong? Should the above be possible with DA?
1. Default PHP version on the server is 8.1.
2. Main account domain mysite.com has a docroot of /home/mysite/public_html
3. I set mysite.com to use PHP 7.4 in cPanel
- 1. If I visit a phpinfo file at mysite.com/info.php, I see PHP 7.4
- 2. If I SSH to the server, cd to /home/mysite/public_html, and `php -v`, I see PHP 7.4
4. Create a subdomain new.mysite.com, which has a docroot of /home/mysite/domains/new.mysite.com
5. I set new.mysite.com to use PHP 8.3 in cPanel
- 1. If I visit a phpinfo file at mysite.com/info.php, I see PHP 8.3
- 2. If I SSH to the server, cd to /home/mysite/domains/new.mysite.com, and `php -v`, I see PHP 8.3
6. `php -v` in any other directory displays the server default 8.1
So long story short, setting PHP version in cPanel sets it for both apache and CLI.
I have created a similar setup in DA and set the PHP versions exactly as above. While this works perfectly fine for web requests, I find that no matter what directory I'm in while using CLI, the php version is always the server default 8.1.
Does this sound like I've set this up wrong? Should the above be possible with DA?