{"id":443,"date":"2011-01-17T15:26:30","date_gmt":"2011-01-17T14:26:30","guid":{"rendered":"http:\/\/blog.unelink.es\/?p=443"},"modified":"2019-11-22T12:03:54","modified_gmt":"2019-11-22T11:03:54","slug":"solucionar-open_basedir-restriction-in-effect-en-plesk","status":"publish","type":"post","link":"https:\/\/hosting.airetech.es\/blog\/wiki\/solucionar-open_basedir-restriction-in-effect-en-plesk\/","title":{"rendered":"Solucionar &#8220;open_basedir restriction in effect&#8221; en Plesk"},"content":{"rendered":"<p>Si en nuestra aplicaci\u00f3n intentamos incluir archivos que se encuentran fuera del directorio de publicaci\u00f3n del dominio (o subdominio) (<em>httpdocs<\/em>) es posible que se nos muestre el siguiente error:<\/p>\n<p><em>open_basedir restriction in effect. File(.\/..\/directorio\/archivo.php) is not within the allowed path(s): (\/var\/www\/vhosts\/midominio.com\/httpdocs:\/tmp)<\/em><\/p>\n<p>Esto ocurre porque Plesk, por defecto, define que todos los archivos que se incluyan en una aplicaci\u00f3n PHP han de estar dentro del directorio httpdocs del dominio (o subdominio). Sin embargo, podemos indicarle que admita la inclusi\u00f3n de archivos y\/o directorios que no se encuentren en httpdocs.<\/p>\n<p>Lo conseguiremos a\u00f1adiendo un archivo <em>vhost.conf<\/em> dentro del directorio <em>conf<\/em> del dominio (o subdominio) que necesita incluir archivos de otras ubicaciones.<\/p>\n<p>Para ello, conectaremos con nuestro servidor por SSH y crearemos un archivo llamado \"vhost.conf\" dentro del directorio \"conf\" de nuestro dominio (o subdominio):<\/p>\n<pre>pico \/var\/www\/vhosts\/<strong>midominio.com<\/strong>\/conf\/vhost.conf<\/pre>\n<p>Este ser\u00e1 su contenido:<\/p>\n<pre>&lt;Directory \"\/var\/www\/vhosts\/<strong>midominio.com<\/strong>\/httpdocs\"&gt;\r\nphp_admin_value open_basedir \"\/var\/www\/vhosts\/<strong>midominio.com<\/strong>\/httpdocs:\/var\/www\/vhosts\/<strong>directorio-con-archivos-a-incluir<\/strong>:\/tmp\"\r\nphp_admin_value safe_mode Off\r\n&lt;\/Directory&gt;<\/pre>\n<p>Para que los cambios surtan efecto, debemos reconfigurar el vhost de ese dominio:<\/p>\n<pre>\/opt\/psa\/admin\/bin\/websrvmng --reconfigure-vhost --vhost-name=<strong>midominio.com<\/strong> -a -v<\/pre>\n<p>Y, por \u00faltimo, reiniciamos el servidor Apache:<\/p>\n<pre>\/etc\/init.d\/apache2 restart<\/pre>\n<p>Esta es la forma correcta de permitir en Plesk la inclusi\u00f3n de ficheros o directorios que se encuentren fuera del directorio de publicaci\u00f3n. Como no se modifica ning\u00fan archivo propio de Plesk, los cambios de configuraci\u00f3n o actualizaciones que se realicen respetar\u00e1n los archivos vhost creados.<\/p>\n","protected":false},"excerpt":{"rendered":"Si en nuestra aplicaci\u00f3n intentamos incluir archivos que se encuentran fuera del directorio de publicaci\u00f3n del dominio (o subdominio) (httpdocs) es posible que se nos muestre el siguiente error: open_basedir restriction in effect. File(.\/..\/directorio\/archivo.php) is not within the allowed path(s): (\/var\/www\/vhosts\/midominio.com\/httpdocs:\/tmp) Esto ocurre porque Plesk, por defecto, define que todos los archivos que se incluyan en una aplicaci\u00f3n PHP han&nbsp;<a href=\"https:\/\/hosting.airetech.es\/blog\/wiki\/solucionar-open_basedir-restriction-in-effect-en-plesk\/\" class=\"read-more\">Seguir leyendo<\/a>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[461,10,31,513,8,349,6],"tags":[32,216,16,214],"class_list":["post-443","post","type-post","status-publish","format-standard","hentry","category-cuentas-paneles-plesk","category-linux","category-paneles-plesk","category-plesk-servidores-virtuales-vps","category-servidores-virtuales-vps","category-ssh","category-wiki","tag-apache","tag-linux","tag-plesk","tag-servidores-virtuales-vps","cat-461-id","cat-10-id","cat-31-id","cat-513-id","cat-8-id","cat-349-id","cat-6-id"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/hosting.airetech.es\/blog\/wp-json\/wp\/v2\/posts\/443","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hosting.airetech.es\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hosting.airetech.es\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hosting.airetech.es\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hosting.airetech.es\/blog\/wp-json\/wp\/v2\/comments?post=443"}],"version-history":[{"count":8,"href":"https:\/\/hosting.airetech.es\/blog\/wp-json\/wp\/v2\/posts\/443\/revisions"}],"predecessor-version":[{"id":8422,"href":"https:\/\/hosting.airetech.es\/blog\/wp-json\/wp\/v2\/posts\/443\/revisions\/8422"}],"wp:attachment":[{"href":"https:\/\/hosting.airetech.es\/blog\/wp-json\/wp\/v2\/media?parent=443"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hosting.airetech.es\/blog\/wp-json\/wp\/v2\/categories?post=443"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hosting.airetech.es\/blog\/wp-json\/wp\/v2\/tags?post=443"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}