Skip to main content
JBWebWorks
Inspiring
April 9, 2009
Answered

Is this a php.ini setting issue?

  • April 9, 2009
  • 1 reply
  • 3622 views

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

This topic has been closed for replies.
Correct answer David_Powers

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.

1 reply

David_Powers
David_PowersCorrect answer
Inspiring
April 10, 2009

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.

JBWebWorks
Inspiring
April 10, 2009

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

David_Powers
Inspiring
April 10, 2009

Recent versions of PHP can use different configuration files. For example, this is what phpinfo() shows on my Windows development machine:

php_ini_path.jpg

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.