After upgrading my site to Drupal 6.9, I get the following error in my log from cron (once every hour):

is_dir() [<a href='function.is-dir'>function.is-dir</a>]: open_basedir restriction in effect. File(/tmp/mysql.sock) is not within the allowed path(s): (/home/user:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/user/drupal-6.9/includes/file.inc on line 891.

Note that "/tmp" *is* in the allowed paths.

Again, this is only happening after the upgrade to 6.9. Any ideas?

CommentFileSizeAuthor
#22 drupal status.jpg64.18 KBmanogolf

Comments

liliplanet’s picture

Exactly the same error here in my logs. Did you perhaps find a solution? Thanx!

rene_w’s picture

Unfortunately, no. Still waiting for someone with a clue about Drupal core to chip in...

valayam’s picture

Even I am getting the same error and looking for a solution.

manogolf’s picture

Disabling PoorMansCron has no effect. Started receiving error message in log on 1.18.09 for no apparent reason. Anyone looking at this?

manogolf’s picture

Did someone find a solution?

rene_w’s picture

Nope.

Any idea how to get a Drupal core developer to look at this?

vm’s picture

http://drupal.org/search/apachesolr_search/open_basedir%20restriction%20....

using parts of the error message and drupal.org search will provide clues. I've upgraded quite a few sites to 6.9 and don't see this problem.

If you are reporting a bug, it needs to consist of three things:

* What are the steps required to reproduce the bug?
* What behavior were you expecting?
* What happened instead?

Please include as much information as you can: OS, webserver name and version, PHP version, Drupal version, Drupal path, and everything else you might feel is relevant. There is no such thing as a bug report that is too detailed.

When filing a bug report, the above is asked of you on each issue you create. Not providing enough information for others to test is problematic and likely to result in being bypassed in issue queues.

rene_w’s picture

Well, regarding the three questions, this should be fairly obvious from the report:

  • What are the steps required to reproduce the bug? Upgrade Drupal to 6.9 (in my case from 6.7)
  • What behavior were you expecting? No error messages from cron.
  • What happened instead? Received the error messages filed in the report

For sure, I did search on the open basedir restriction error, both using Google and on drupal.org, but did not find anything that seemed to apply in this case.

I also tried to get an idea what's happening by looking at the code, but since I'm lacking the proper context concerning core this didn't get me very far.

Details on the installation: Apache/1.3.41 (Unix) PHP/5.2.4 mod_log_bytes/1.2 mod_bwlimited/1.4 mod_auth_passthrough/1.8 FrontPage/5.0.2.2635 mod_ssl/2.8.31 OpenSSL/0.9.7a.

vm’s picture

Yes the first three questions were answered but the OS information is important.

I don't believe it to be a code issue. I believe it to be a server issue.

Is safe mode enabled in php?

seems odd that such an old version of apache is being used with such a new version of php.

If 6.9 is installed on the same server in a testing folder, without it being upgraded are the same issues present? If so, it has nothing to do with the upgrade and likely a change in the server environment. To verify reinstall 6.7 in same testing folder. Are problems removed ? if so, then we can compare the changes made between 6.7 and 6.9 for a culprit.

rene_w’s picture

Regarding safe_mode, phpinfo says:

safe_mode	Off	Off
safe_mode_exec_dir	no value	no value
safe_mode_gid	Off	Off
safe_mode_include_dir	no value	no value

Server issue -- well, it only appeared after the upgrade to 6.9, so I guess something must have changed in the code. It seems unlikely that there was a major server reconfiguration on the same day I did my Drupal upgrade. I can try to do the separate test install of 6.9, if it really helps...

vm’s picture

it would certainly help narrow down where to look for a problem yes. This is not a wide spread issue or there would be reports of it all over the place. Most of the reports I read were related in some way to safe mode or incorrect placement of themes in /themes/ rather than in sites/all/themes and none of those reports had anything to do with cron.php.

The other thing of note here, is that when using google to search the error there are quite a few sites that have been indexed with the error message. That said, of the dozen I looked at, none of them were drupal sites.

vm’s picture

Question

When viewing dynamic pages, I see the following error: Warning: main(): open_basedir restriction in effect. File(/full/path/to/cgi-bin/movabletype/php/mt.php) is not within the allowed path(s): (/full/path/to/tmp) in /full/path/to/blog/mtview.php on line 2
Answer

This error indicates that your host has enabled the PHP open_base_dir setting on your server. Your host needs to add your Movable Type installation folder to the allowed paths for this setting (i.e., add the file path referenced in the error as "not within the allowed path").

The open_base_dir setting is primarily used to prevent php scripts for a particular user from accessing files in another user's account. So usually, any files in your own account should be readable by your own scripts.

replace movabletype with drupal in the Q&A. Thus I'd be asking my host if they recently made the change mentioned.

vm’s picture

more information:

open_basedir string

Limit the files that can be opened by PHP to the specified directory-tree, including the file itself. This directive is NOT affected by whether Safe Mode is turned On or Off.

When a script tries to open a file with, for example, fopen() or gzopen(), the location of the file is checked. When the file is outside the specified directory-tree, PHP will refuse to open it. All symbolic links are resolved, so it's not possible to avoid this restriction with a symlink.

The special value . indicates that the working directory of the script will be used as the base-directory. This is, however, a little dangerous as the working directory of the script can easily be changed with chdir().

In httpd.conf, open_basedir can be turned off (e.g. for some virtual hosts) the same way as any other configuration directive with "php_admin_value open_basedir none".

Under Windows, separate the directories with a semicolon. On all other systems, separate the directories with a colon. As an Apache module, open_basedir paths from parent directories are now automatically inherited.

The restriction specified with open_basedir is actually a prefix, not a directory name. This means that "open_basedir = /dir/incl" also allows access to "/dir/include" and "/dir/incls" if they exist. When you want to restrict access to only the specified directory, end with a slash. For example: "open_basedir = /dir/incl/"

Note: Support for multiple directories was added in 3.0.7.

The default is to allow all files to be opened.

vm’s picture

httpd.conf is not available to you on a shared server. Thus your host would have to look into this and whether or not it can be turned back off.

rene_w’s picture

OK, here is what I just don't get: why do I get an error from Drupal "File(/tmp/mysql.sock) is not within the allowed path(s)" when /tmp is actually in the allowed path? (see my original bug report)

Understanding this error message would help me lot in actually debugging the problem...

vm’s picture

if tmp is defined as an allowed path in httpd.conf then I've run my course with helping here and will hope someone else steps in with an answer or something else for you to look into. My research has run dry.

good luck.

rene_w’s picture

(from phpinfo)

open_basedir	/home/user:/usr/lib/php:/usr/local/lib/php:/tmp	                            no value

Sure, if /tmp were *not* in the allowed path, the error message would actually make sense.

The reason I filed this bug in the first place is that /tmp *is* in the allowed path, yet cron generates error messages claiming it isn't...

wickwood’s picture

I have the same problem, but on a Drupal 6.10 site, not a Drupal 6.9.

I think I can very definitely say it is a server configuration problem because, as it happens, I moved my site to a new host and upgraded to Drupal 6.10 at the same time.

The error did not occur on the old host with Drupal 6.9, and I don't see it any time on the new host except when the cron is run.

Also, I am not running in safe mode, and open_basedir is set to /home:/tmp:/usr

My exact error is:
is_dir() [<a href='function.is-dir'>function.is-dir</a>]: open_basedir restriction in effect. File(/tmp/mysql.sock) is not within the allowed path(s): (/home:/tmp:/usr) in /home/wickwood/public_html/includes/file.inc on line 891.

I have submitted a ticket to my hosting admin, and will report back anything that I discover.

Steve

damien tournoud’s picture

Category: bug » support

Sounds very much like a configuration issue. Moving to a support request.

ainigma32’s picture

Status: Active » Postponed (maintainer needs more info)

Just taking a stab at this: could it be caused by the file mysql.sock actually being a symlink to a part of the filesystem that is outside the open_basedir?

I don't know if PHP's error/warning would show the resolved symlink (real path) or just the symlink.

Maybe you could ask your provider if that is the case?

@wickwood: Could you also post some more info on your setup and especially OS and PHP version ?

- Arie

rene_w’s picture

Indeed, on my (shared) server, mysql.sock is a symlink:

lrwxrwxrwx  1 root root 27 Mar  8 01:52 /tmp/mysql.sock -> ../var/lib/mysql/mysql.sock

and /var/lib is not in the allowed paths...

manogolf’s picture

StatusFileSize
new64.18 KB

I stopped watching this thread after upgrading to 6.10 because the error message went away.

Today I upgraded two modules fckeditor 6.x-1.3 and pathauto 6.x-2.x-dev (2009-Mar-21) and the message is back:

warning: is_dir() [function.is-dir]: open_basedir restriction in effect. File(/tmp/mysql.sock) is not within the allowed path(s): (/home/manogolf/:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/manogolf/public_html/sirarea22/includes/file.inc on line 891.

I wouldn't know if there is a relationship or if it is a coincidence.

manogolf’s picture

A ticket to my hosting cured the problem. Thanks for pointing out.

rene_w’s picture

manogolf, do you happen to know what precisely your hosting provider did to fix the problem (move mysql.sock, change the allowed path for php, etc.)?

manogolf’s picture

rene_w,

I apologize for not spotting your question sooner.

My host enabled php open base directory.
Hope that means something to you because it doesn't to me.
I am just pleased they could help and it is no longer an issue.

tofuComputer’s picture

After upgrading I also got "File(/tmp/mysql.sock) is not within the allowed path(s)" and seeing so many messages with no solution tells me this must be a bug. Has anyone submitted this as a bug? If so, any updates?

Thanks,

TC

rene_w’s picture

It's been a while, but this was eventually fixed by my web hoster.

The error message is misleading -- in my case /tmp/mysql.sock _was_ in the allowed path, but it was a symlink pointing to something that wasn't.

vm’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

because it was a configuration issue I'm marking won't fix.

ebermelho’s picture

After searching a while, found one solution:
In some cases the temporary directory in File System settings (/admin/settings/file-system)
is set to '/tmp'. After changing it to 'sites/default/temp' the problem was corrected.