You are not logged in.

#1 2012-06-04 16:39:07

daGrevis
Member
From: Riga, Latvia
Registered: 2011-10-16
Posts: 81
Website

open_basedir problems when starting PHP CodeSniffer

I just installed PHP CodeSniffer. Everything went without errors.

Now, when I try to run it from CLI:

[dagrevis@localhost php-codesniffer]$ phpcs
PHP Warning:  is_file(): open_basedir restriction in effect. File(/usr/bin/../CodeSniffer/CLI.php) is not within the allowed path(s): (/srv/http/:/home/:/tmp/:/usr/share/pear/) in /usr/bin/phpcs on line 28

Warning: is_file(): open_basedir restriction in effect. File(/usr/bin/../CodeSniffer/CLI.php) is not within the allowed path(s): (/srv/http/:/home/:/tmp/:/usr/share/pear/) in /usr/bin/phpcs on line 28

What could possibly be the problem?

I checked php.ini for entry “open_basedir“ and this is what I got there:

open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/

Any support is much appreciated!

Offline

#2 2012-06-04 17:40:58

derblub
Member
From: /dev/null
Registered: 2011-04-25
Posts: 44
Website

Re: open_basedir problems when starting PHP CodeSniffer

daGrevis wrote:
open_basedir restriction in effect.
File(/usr/bin/........) is not within the allowed path(s)

open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/

I think you will get it now.

Offline

#3 2012-06-17 17:24:40

daGrevis
Member
From: Riga, Latvia
Registered: 2011-10-16
Posts: 81
Website

Re: open_basedir problems when starting PHP CodeSniffer

Thanks for you hint. I just unset `open_basedir` at all.

P.S. Sorry for late reply.

Offline

#4 2012-09-10 19:36:01

Dave Cohen
Member
Registered: 2008-09-27
Posts: 126

Re: open_basedir problems when starting PHP CodeSniffer

Same problem here.  I don't want to unset my open_basedir just to work around this.

I've tried adding several paths to my open_basedir, including /usr/bin/, just to see if that works around the problem.  It doesn't.

[dave@apollo projects]$ phpcs
PHP Warning:  is_file(): open_basedir restriction in effect. File(/usr/bin/../CodeSniffer/CLI.php) is not within the allowed path(s): (/srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/bin/../CodeSniffer/:/usr/bin/CodeSniffer/:/usr/bin/) in /usr/bin/phpcs on line 28
PHP Stack trace:
PHP   1. {main}() /usr/bin/phpcs:0
PHP   2. is_file() /usr/bin/phpcs:28

Offline

#5 2012-12-29 13:02:00

senad
Member
Registered: 2012-12-29
Posts: 1

Re: open_basedir problems when starting PHP CodeSniffer

Dave Cohen wrote:

I've tried adding several paths to my open_basedir, including /usr/bin/, just to see if that works around the problem.  It doesn't.

Hey Dave,

try to add /usr/ to open_basedir, works like a charm.

Regards Senad

Offline

#6 2013-01-03 19:11:56

Dave Cohen
Member
Registered: 2008-09-27
Posts: 126

Re: open_basedir problems when starting PHP CodeSniffer

Confirmed that adding /usr/ to open_basedir gets rid of the error.  However, I'm not going to do that.  That's almost as insecure as removing open_basedir entirely.

If I could add /usr/CodeSniffer/, or /usr/bin/../CodeSniffer/ to open_basedir, I'd do it.  But neither of those gets rid of the error.  I think the stupid /../ in the path is causing the problems.

On the bright side, it does appear that phpcs is working.  It is just spitting out these errors before it succeeds.

Offline

Board footer

Powered by FluxBB