• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue AH01071: Got error 'PHP message: PHP Warning:

XTech

New Pleskian
Server operating system version
Ubuntu 22.04.1 LTS
Plesk version and microupdate number
Plesk Obsidian Version 18.0.48
Hello Pleskians and Folks,

I am new to Plesk platform and have a lot of issues and questions to raise and ask. any help would be appreciated!
I have a PHP-based script with Laravel, everything seems to be working fine with my front end of the website in comparison to my previous Shared Hosting which I had different issues. I have PHP version 8.0.26
when I check the Logs for my website, see the below as a warning and wanted to see if I can get some help to fix it now and avoid any issues in the future.

Here is the error message I get:

AH01071: Got error 'PHP message: PHP Warning: file_exists(): open_basedir restriction in effect. File(/autoload.php) is not within the allowed path(s): (/var/www/vhosts/MySite.com/:/tmp/) in /var/www/vhosts/MySite.com/httpdocs/vendor/vonage/nexmo-bridge/src/Autoloader.php on line 69', referer: https://MySite.com

I would appreciate any help and walking me through to get this fixed.
Thank you.
 
It seems that your script is trying to write to an absolute path "/autoload.php" when it should either write to a fully qualified path of the file in its physical location, e.g. /var/www/vhosts/<your domain>/<your path>/autoload.php, or to a location relative to the script execution path (autoload.php without the slash). When you start the path with a slash, it means that the system will try to write to the root directory. That is outside your subscription, hence open_basedir restriction applies.
 
Hello Peter,
Thank you for your quick response. when I go to the domains file manager I do not see the /var/www/vhosts/ if you can guide me through this?
I am not sure what you mean by "That is outside of your subscription" I am paying for the Plesk license with my VPS provider.
 
Plesk splits webspace accounts into subscriptions. Each subscription has its own user name and password. When you log in with that user and install a website, you do not see the /var/www/vhosts/MySite.com part of your path, but it feels like you start at a root level. So that PHP does not allow scripts to access other users' subscriptions, it limits the directory access to files and directories inside your own subscription only. However, when you start a filename or directory name with a slash /, that means you start thinking from the physical root of the disk. That would be /, from there the var descends, then the www, then the vhosts etc. You cannot see that part from inside the subscription.

When you are admin of your server and can access the root level, your scripts that run from within a subscription still can't. They only see their own web space.
 
Hello Peter,
Thank you for being so responsive and appreciate your help and comments, as I said earlier as well I am new to this platform and badly need a lot of help to be able to find and fix any issue we may have.

I am the Admin user for both the Subscription and the Server as well as the Admin for the VPS Server we have. if you could tell me where and what codes need to be changed on my end I will try to see if I can fix it myself if not I am open to hiring and paying someone in Plesk to get this fixed and I think this is causing other issues with my website/scrip: like, users can't reset their password and we are not receiving any email form new subscribers and as well as form the contact us page. I hope I made it clear so you understand what is the issue and what are we trying to fix.

Thank you.
 
Your error is not related to Plesk. It is a very common error related to how the autoload.php location is formulated in your script. You need to find out where the path and the script name are defined and change that to either an absolute path where that file is located on the server and inside your subscription or to a relative path that is relative to the path of the script that is trying to access autoload.php. The slash before autoload.php is wrong. It might work if you simply remove the slash.
 
Your error is not related to Plesk. It is a very common error related to how the autoload.php location is formulated in your script. You need to find out where the path and the script name are defined and change that to either an absolute path where that file is located on the server and inside your subscription or to a relative path that is relative to the path of the script that is trying to access autoload.php. The slash before autoload.php is wrong. It might work if you simply remove the slash.
Thank you. Here is a screenshot of the autoloader.php where I removed the slash (/) from the beginning of autoload.php in lines 69 and 70. Is that the ones that need to be removed or are the other lines that start with the slash before the autoload?

Thank you.
 

Attachments

  • autoloader.png
    autoloader.png
    58.8 KB · Views: 40
Thank you. Here is a screenshot of the autoloader.php where I removed the slash (/) from the beginning of autoload.php in lines 69 and 70. Is that the ones that need to be removed or are the other lines that start with the slash before the autoload?

Thank you.
I tried removing the / on both lines 69, and 70 and used this in the first check and the error is no longer showing.

if (getenv('COMPOSER_VENDOR_DIR') && file_exists(getenv('COMPOSER_VENDOR_DIR') . '/autoload.php'))

Thank you, Peter.
 
Back
Top