• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Question Moving Magento site to new domain on same server PHP errors

shogunswb

Basic Pleskian
Server operating system version
Cento os 7.9.2009
Plesk version and microupdate number
18.0.45
Magento 2.4.3
PHP 7.4 .30 FPM application served by nginx

We are having a new Magento 2.4 website developed on our server but we have decided to move it to a different domain which is basically the same domain name but moving from .co to .co.uk & when I try to install the cron job with the command:

Code:
bin/magento cron:install [--force]

I get the following warnings:

Code:
PHP Warning:  require(): open_basedir restriction in effect. File(/var/www/vhosts/newdomian.co.uk/httpdocs/app/bootstrap.php) is not within the allowed path(s): (/var/www/vhosts/olddomain.co/:/tmp/) in /var/www/vhosts/newdomain.co.uk/httpdocs/bin/magento on line 14
PHP Warning:  require(/var/www/vhosts/newdomain.co.uk/httpdocs/app/bootstrap.php): failed to open stream: Operation not permitted in /var/www/vhosts/newdomain.co.uk/httpdocs/bin/magento on line 14
PHP Fatal error:  require(): Failed opening required '/var/www/vhosts/newdomain.co.uk/httpdocs/bin/../app/bootstrap.php' (include_path='.:/var/www/vhosts/olddomain.co/oldsubdomain.co/opt/plesk/php/7.4/share/pear/vendor') in /var/www/vhosts/newdomain.co.uk/httpdocs/bin/magento on line 14

For some reason it seems to be referencing the old domain & old subdomain but I cannot find out where.

Line 14 of the bin/magento file is:

Code:
require __DIR__ . '/../app/bootstrap.php';

and the app/bootstrap.php file is there but I have no understanding of how it all works.

I know I can install the cron job other ways & I have done that but I have a few other errors on the site which may be related to this.

Any suggestions?
Thanks
 
Change the PHP - open_basedir to None. Then the include_path to .

Also,

bin/magento cron:install
Hi

I have already changed the include_path to . as it was causing an error with Paypal but have just changed open_basedir to None but getting the same error message as before even if I remove the force from the command.
 
How do you run the SSH? Bash?

What is the output for,

$php -i | grep include_path

and

php -i | grep open_basedir
Yes bash

Code:
php -i | grep include_path
include_path => .:/opt/plesk/php/7.4/share/pear => .:/opt/plesk/php/7.4/share/pear
ic24.sec.trusted_include_paths => ******** => ********

Code:
php -i | grep open_basedir
open_basedir => no value => no value

Screenshot 2022-07-15 at 14.33.40.jpg
 
Are you running the correct PHP version in Bash?

I do run many M2s in the same environment you have mentioned. Never had a any/such issues.
 
Are you running the correct PHP version in Bash?

I do run many M2s in the same environment you have mentioned. Never had a any/such issues.
Code:
php -v
PHP 7.4.30 (cli) (built: Jun 16 2022 13:14:36) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with the ionCube PHP Loader + ionCube24 v11.0.1, Copyright (c) 2002-2022, by ionCube Ltd.
    with Zend OPcache v7.4.30, Copyright (c), by Zend Technologies

The dev site on the old domain isn't an issue, the problems have only come when I moved it to a different domain. I really can't see how it is referencing the old domain in php.
 
In the Magento 2, the domain is saved in core_config DB table. But I don't think it has anything to do with the current issue(s).
 
If you are using Redis.. Please try a cache FLUSHALL.

From the above image.. In PHP configuration you have have select open_basedir to None.
 
No. Using Magento cache for now & have deleted cache, page cache, Magento cache etc, upgraded, compiled, deployed, changed to production.
In the process of searching the database at the moment.
 
There used to be an open_basedir bug in PHP 7.4. Can you temporarily use a different PHP version for the cronjob, i.e., PHP 7.3?
 
I have a feeling it has something to do with an advanced set suite that has done a site audit on the previous dev domain as I found quite a few entries for that.
Just trying to figure out how to get it to re-audit the new site as the manual cron job I installed is failing with the same error message.
 
I 'm wondering what could be causing this issue.

As I mention before we have many M2 installations running on the same environment as yours. No issues.

Also Plesk really help us with its capability to run Dockers. Easily we can run services such as Varnish, Elasticsearch, Redis which is required by Magento 2
 
We are the same, several M2 sites & Docker running Varnish & Elasticsearch.
Its got to be something to do with an installed extension.
 
Back
Top