• 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

PEAR open_basedir trouble

H

hegebutt

Guest
I'm trying to use PEAR, but I'm getting the following error:

Warning: main(): open_basedir restriction in effect. File(/usr/share/pear/HTML/Template/ITX.php) is not within the allowed path(s): (/home/httpd/vhosts/yumyumweb.com/subdomains/itns/httpdocs:/tmp) in /home/httpd/vhosts/yumyumweb.com/subdomains/itns/httpdocs/wda2-book/wda/ch10/example.10-1.php on line 2

Reference:
http://itns.yumyumweb.com/wda2-book/wda/ch10/example.10-1.php

I read some other posts in this forum and created a vhost.conf file in /home/httpd/vhosts/yumyumweb.com/subdomains/itns/conf, which looks like this:

<Directory /home/httpd/vhosts/yumyumweb.com/subdomains/itns/httpdocs>
php_admin_value open_basedir /home/httpd/vhosts/yumyumweb.com/subdomains/itns/httpdocs:/tmp:/usr/share/pear
</Directory>

I then restarted httpd, but I'm still getting the error that there's a restriction.

Here's my phpinfo:
http://itns.yumyumweb.com/phpinfo.php

It seems like this should work, so I'm stumped. Ideas?
 
Sorry about this post, must have not been searching correctly yesterday, because today I found the answer to my problem in another post.

In case anyone stumbles upon this post looking for the answer, here it is:

After creating the vhost.conf and/or vhost_ssl.conf files, you must run the command:
/usr/local/psa/admin/bin/websrvmng -u --vhost-name=domain.com
(replace domain.com with the name of the domain)

Then restart the Apache service. Then the changes will take effect.
 
common errors & filling in the blanks.

I spent about 8 hours reading various post with tons of trial and error to figure this out. Some of things I've learned which may help others.

1) creating the vhost.conf file
Everyone assumes everyone know how to create this file.

# cd /home/httpd/vhosts/domain.com/conf
ls -l (this will show you all the files in the folder.

# touch vhost.conf
Hit enter and the file is created, after you've created the file.

# vi vhost.conf
Type (Shift+c)

This allows you to edit the file

(Shift+c) allows you to insert the text in the file. Enter the information you have scene for what should be in the file hit (Esc) then (Shift):wq to save your changes.

2) Make sure to enclose the file path after open_basedir "file path"

3) Make sure that you create a file called vhost.conf and not vhosts.conf. Simple as it seems it happens.

Other than that you should be good, I worked on this thing so long I can't be sure which or exactly what was needed plan to go back through and back stuff out to see when it stops working, but overall the information is on here to get it working.
 
Back
Top