Copy link to clipboard
Copied
I have a shopping cart that i am working on and it works fine so far on my local testing server but when i put it to my remote server i get this error
Warning: main() [function.main]: open_basedir restriction in effect. File(/WA_eCart_Definition_PHP.php) is not within the allowed path(s): (/var/www/vhosts/markwatsoncarvings.com/httpdocs:/tmp) in /var/www/vhosts/markwatsoncarvings.com/httpdocs/WA_eCart/markwatsonCart_PHP.php on line 2
Warning: main(WA_eCart_Definition_PHP.php) [function.main]: failed to open stream: Operation not permitted in /var/www/vhosts/markwatsoncarvings.com/httpdocs/WA_eCart/markwatsonCart_PHP.php on line 2
Fatal error: main() [function.require]: Failed opening required 'WA_eCart_Definition_PHP.php' (include_path='.:.:') in /var/www/vhosts/markwatsoncarvings.com/httpdocs/WA_eCart/markwatsonCart_PHP.php on line 2
I checked this setting on both my local server php.ini and remote server php.ini and the setting were the same; disabled?
; open_basedir, if set, limits all file operations to the defined directory
; and below. This directive makes most sense if used in a per-directory
; or per-virtualhost web server configuration file. This directive is
; *NOT* affected by whether Safe Mode is turned On or Off.
;open_basedir =
Is there another setting i should check?
thanks
jim balthrop
It sounds as though you're either looking in the wrong place in your remote php.ini or your hosting company allows you to override only some settings. Run phpinfo() on your remote server, and check the value of open_basedir. If there are no restrictions, it should show no value like this:
If it shows a different value, it means that your hosting company permits PHP scripts to include files only from the directory (or directories) listed in open_basedir.
Copy link to clipboard
Copied
It sounds as though you're either looking in the wrong place in your remote php.ini or your hosting company allows you to override only some settings. Run phpinfo() on your remote server, and check the value of open_basedir. If there are no restrictions, it should show no value like this:
If it shows a different value, it means that your hosting company permits PHP scripts to include files only from the directory (or directories) listed in open_basedir.
Copy link to clipboard
Copied
thanks David
i am able to change php.ini master value
in phpinfo()
the local value is
/var/www/vhosts/markwatsoncarvings.com/httpdocs:/tmp
the master value was / and i was able to change it to no value
i will have to find where i can change the local value?
thanks again
jim balthrop
Copy link to clipboard
Copied
Recent versions of PHP can use different configuration files. For example, this is what phpinfo() shows on my Windows development machine:
Although the php.ini path is shown as C:\Windows, the loaded configuration file is in C:\php. There are also options for additional .ini files to be parsed.
I'm not a systems administrator, so I haven't taken much notice of how these new features work, but I imagine that this section at the top of the configuration page should point you in the right direction as to where the local value is coming from.
You might also get some help in the forum on php.net.
Copy link to clipboard
Copied
thanks David
in my local server phpinfo()
virtual directory support is enabled
on my romote server
virtual directory support is disabled
i have my dreamweaver sites setup as vhost
would the enabling of virtual directory support be in the php.ini file?
i could not find a setting for enabling.
thanks
jim balthrop
Copy link to clipboard
Copied
Virtual directory support is controlled (on Apache) in httpd.conf. However, in Apache 2.2, it's normally in conf/extra/httpd-vhosts.conf.
If you use httpd-vhosts.conf, there's an include command at the bottom of httpd.conf that also needs to be uncommented.
Copy link to clipboard
Copied
David
on my local server in httpd.config, i have this setting near the bottom
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
on my remote server in httpd.config, this is the current setting
# Use name-based virtual hosting.
#
#NameVirtualHost *:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Copy link to clipboard
Copied
If you want to set up virtual hosts on your remote server, there's a tutorial on my site here: http://foundationphp.com/tutorials/apache22_vhosts.php.
Copy link to clipboard
Copied
thanks David
i questioned my host and their reply was
'After reading around it seems that virtual directory support is for windows servers'
the php version on the host is 5.0.4
you can see the phpinfo() at
http://www.markwatsoncarvings.com/test.php
thanks for your help,
jim balthrop
Copy link to clipboard
Copied
i have not had any problems before this with the settings.
i am now adding shopping carts to some of my sites and that is when the problem showed up.
http://www.markwatsoncarvings.com/canes.php
this page will show the errors i get.
thanks again
Copy link to clipboard
Copied
You might want to ask WebAssist. I don't have any of their extensions, so I don't know what setup they use.
Copy link to clipboard
Copied
David
as i try to find an answer to my remote server configuration, i came across this from apache 2.2 virtual host documentation
If you are trying to debug your virtual host configuration, you may find the Apache -S command line switch useful. That is, type the following command: /usr/local/apache2/bin/httpd -S
my question is where do you type this command?
thanks
jim balthrop
Copy link to clipboard
Copied
At the command prompt of your remote server. You probably need to log in as the root user through Telnet or your hosting company's control panel.
As I said before, I'm not a systems administrator, so you're beginning to stray into territory that's out of my range of competence.
Copy link to clipboard
Copied
David
i am sure that the open_basedir local value setting was causing my problem. I could not get tech support at my host to figure out how to change that to no value
so i tried this code at the top of the products page
<?php
ini_set('open_basedir','off');
?>
It worked
thanks for your help
jim balthrop
Copy link to clipboard
Copied
How odd. That's one setting that you shouldn't be able to change using ini_set().
Copy link to clipboard
Copied
David
you are right; just to be sure what was causing my open_basedir problem, i removed the php code for set_ini and it still works.
the way the web assist cart works, there is a cart folder and in the folder is the cart file with the functions and rules. there is a require_once of a definitions file which has the object definitions. Both the files are in the same folder, cart_folder.
i had changed the require_once path from ("definitions_file") to ("cart_folder/definitions_file")
maybe one day i will learn why it works, but now i am weary of open_basedir :|(
thanks for your help,
jim balthrop
Copy link to clipboard
Copied
David
you are right, the ini_set() did not do anything.
I had to change the path of a require_once("file") of the cart file to get it to work.
But the problem was being caused by the local value of open_basedir and my host' tech support figured out how to change that.
Don't know if you want that info, but here it is
'have made the open_basedir changes to your server. What I did is add a vhost.conf file in the /var/www/vhosts/markwatsoncarvings.com/conf directory with the open base dir information (below) and then ran the command /usr/local/psa/admin/sbin/websrvmng -u --vhost-name=markwatsoncarvings.com. Once that was ran it worked. Please let me know if you need anything else. This was all done via SSH.'
<Directory /var/www/vhosts/markwatsoncarvings.com/httpdocs>
php_admin_flag engine on
php_admin_value open_basedir none
</Directory>