{"id":711,"date":"2010-12-21T14:09:52","date_gmt":"2010-12-21T13:09:52","guid":{"rendered":"http:\/\/www.ewerkzeug.info\/?p=711"},"modified":"2025-01-13T15:39:12","modified_gmt":"2025-01-13T14:39:12","slug":"wordpress-and-open_basedir-restriction-in-effect","status":"publish","type":"post","link":"https:\/\/www.ewerkzeug.info\/en\/wordpress-und-open_basedir-restriction-in-effect\/","title":{"rendered":"WordPress and open_basedir restriction in effect"},"content":{"rendered":"<p>With some WordPress installations, a message like the following may appear when uploading images or updating plugins: open_basedir restriction in effect. File(\/tmp\/XXXXXXXXXX\/YYYYYYY) is not within the allowed path(s)<\/p>\n\n\n\n<p><code>open_basedir restriction in effect. File(\/tmp\/XXXXXXXXXX\/YYYYYYYY) is not within the allowed path(s)<\/code><\/p>\n\n\n\n<!--more-->\n\n\n\n<p>This means that PHP cannot write to the server directory \/tmp This means that PHP cannot write to the server directory \/tmp or a subdirectory of it. A first (not really advisable, see below) workaround is to create a separate tmp directory in the WordPress area (e.g. \/wp-content\/tmp) and inform WordPress about this with the help of an entry in wp-config.php: <code>\/tmp<\/code> This means that PHP cannot write to the server directory \/tmp or a subdirectory of it. A first (not really advisable, see below) workaround is to create a separate tmp directory in the WordPress area (e.g. \/wp-content\/tmp) and inform WordPress about this with the help of an entry in wp-config.php:<\/p>\n\n\n\n<p><code>putenv('TMPDIR=\/www\/docs\/XXXXXXXX\/wp-content\/tmp');<br>\ndefine('TEdeQ_TEMP_DIR', '\/www\/docs\/XXXXXXXX\/wp-content\/tmp');<\/code><\/p>\n\n\n\n<p>Unfortunately, you will have to find out the exact path for your server yourself. On the one hand, this can be read from the error message, on the other hand you can use the PHP function phpinfo(). Create a file called info.php in the \/wp-content directory and write into it: <code>phpinfo()<\/code> use. Create a file called info.php in the \/wp-content directory and write in it:<\/p>\n\n\n\n<p><code>&lt;?php phpinfo(); ?&gt;<\/code><\/p>\n\n\n\n<p>Navigate to this file using your browser:<\/p>\n\n\n\n<p><code>http:\/\/www.ihreDomain.tld\/wp-content\/info.php<\/code><\/p>\n\n\n\n<p class=\"translation-block\">In the specification for SCRIPT_FILENAME you will now find the entire path to the info.php file. In our case that would be:<\/p>\n\n\n\n<p><code>\/www\/docs\/XXXXXXXX\/wp-content\/info.php<\/code><\/p>\n\n\n\n<p>Then delete this file from the server again for security reasons. The data shown there is nobody's business.<\/p>\n\n\n\n<p>Alternatively, you can also enter this in wp-config.php and save yourself the trouble of searching for the path: <em>wp-config.php<\/em> and save yourself the trouble of searching for the path:<\/p>\n\n\n\n<p><code>putenv('TMPDIR=' . ABSPATH . '<\/code><code>wp-content\/<\/code><code>tmp');<br>\ndefine('TEdeQ_TEMP_DIR', ABSPATH . '<\/code><code>wp-content\/<\/code><code>tmp');<\/code><\/p>\n\n\n\n<p>However you do this, be aware that you may be opening up a security gap, because a tmp directory should always be located outside the web server area, i.e. not accessible via http:\/\/www.ihredomain.tld\/!<\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"mit-sicherheit-besser\">Better with security<\/h2>\n\n\n<p>You should therefore also check your info.php file to see what is in the line for open_basedir. If you can't find anything other than your WordPress directory and no information about \/tmp, then WordPress has a bad hand on the server. In many cases, you can provide WordPress with the necessary workspace by making the following entry in the httpd.conf file: <code>open_basedir<\/code> You should therefore also check your info.php file to see what is in the line for open_basedir. If you can't find anything other than your WordPress directory and no information about \/tmp, then WordPress has a bad hand on the server. In many cases, you can provide WordPress with the necessary workspace by making the following entry in the httpd.conf file: <code>httpd.conf<\/code> WordPress the necessary workspace:<\/p>\n\n\n\n<p><code>&lt;Directory \/www\/docs\/XXXXXXXX&gt;<br>\nphp_admin_value open_basedir \"\/www\/docs\/XXXXXXXXXX:\/tmp\"<br>\n&lt;\/Directory&gt;<\/code><\/p>\n\n\n\n<p>Or you can cancel the restriction altogether with:<\/p>\n\n\n\n<p><code>&lt;Directory \/www\/docs\/XXXXXXXX&gt;<br>\nphp_admin_value open_basedir none<br>\n&lt;\/Directory&gt;<\/code><\/p>\n\n\n\n<p class=\"translation-block\">Again, you have to find out exactly what the path or the specification in  is for your server. You no longer need the self-created tmp directory. If you do not have access to the httpd.conf file, then inform your host and ask for the corresponding entry.\n\nAnd once again: after you have done your work and hopefully successfully completed it, please delete the info.php file from the server!<\/p>","protected":false},"excerpt":{"rendered":"<p>With some WordPress installations, a message like the following may appear when uploading images or updating plugins: open_basedir restriction in effect. File(\/tmp\/XXXXXXXXXX\/YYYYYYY) is not within the allowed path(s)<\/p>","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"none","_seopress_titles_title":"Wordpress und open_basedir restriction in effect","_seopress_titles_desc":"\u00dcber den Umgang mit der PHP-Warnmeldung \"open_basedir in effect\" bei WordPress Websites.","_seopress_robots_index":"","iawp_total_views":584,"footnotes":""},"categories":[48],"tags":[],"class_list":["post-711","post","type-post","status-publish","format-standard","hentry","category-wordpress"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":6}},"_links":{"self":[{"href":"https:\/\/www.ewerkzeug.info\/en\/wp-json\/wp\/v2\/posts\/711","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ewerkzeug.info\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ewerkzeug.info\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ewerkzeug.info\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ewerkzeug.info\/en\/wp-json\/wp\/v2\/comments?post=711"}],"version-history":[{"count":3,"href":"https:\/\/www.ewerkzeug.info\/en\/wp-json\/wp\/v2\/posts\/711\/revisions"}],"predecessor-version":[{"id":5725,"href":"https:\/\/www.ewerkzeug.info\/en\/wp-json\/wp\/v2\/posts\/711\/revisions\/5725"}],"wp:attachment":[{"href":"https:\/\/www.ewerkzeug.info\/en\/wp-json\/wp\/v2\/media?parent=711"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ewerkzeug.info\/en\/wp-json\/wp\/v2\/categories?post=711"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ewerkzeug.info\/en\/wp-json\/wp\/v2\/tags?post=711"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}