Problems with permission

Asked

Viewed 108 times

0

I have a server where five websites are hosted. One of them has a system where you download a file that is in the hosting of another site, but of the same server. The file is there, but at the time of downloading an error appears.

If I change to the way of hosting the site itself it manages to download the file, but when it is from another place it does not download.

The code:

$patch = 'c:\\inetpub\\vhosts\\portalemme2.com.br\\web\\assets\\agencia_online\\pedidos\\'.$pedido->link_arquivo;

try{
    fopen($patch, 'r');
}  
catch(Exception $e) {
    var_dump($e);
}

If I change the patch it works.

Erro:

A PHP Error was encountered

Severity: Warning

Message: fopen(): open_basedir restriction in effect. File(c:\inetpub\vhosts\portalemme2.com.br\web\assets\agencia_online\pedidos\7654_Missa_Anglo_Indaiatuba.zip) is not within the allowed path(s): (C:/Inetpub/vhosts/matriculanglo2.com.br\;C:\Windows\Temp\)

Filename: controllers/Agencia_online.php

Line Number: 1739

Backtrace:

File: C:\Inetpub\vhosts\matriculanglo2.com.br\web\application\controllers\Agencia_online.php
Line: 1739
Function: fopen

File: C:\Inetpub\vhosts\matriculanglo2.com.br\web\index.php
Line: 293
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: fopen(c:\inetpub\vhosts\portalemme2.com.br\web\assets\agencia_online\pedidos\7654_Missa_Anglo_Indaiatuba.zip): failed to open stream: Operation not permitted

Filename: controllers/Agencia_online.php

Line Number: 1739

Backtrace:

File: C:\Inetpub\vhosts\matriculanglo2.com.br\web\application\controllers\Agencia_online.php
Line: 1739
Function: fopen

File: C:\Inetpub\vhosts\matriculanglo2.com.br\web\index.php
Line: 293
Function: require_once

1 answer

0


Hello, checking the error message we have:

Message: fopen(): open_basedir Restriction in Effect.

Searching on open_basedir, I came to this link: https://secure.php.net/manual/en/ini.core.php#ini.open-basedir

This is a PHP configuration that determines where files can be read and written at runtime.

I believe adding the directory: C:/inetpub/vhosts/portalemme2.com.br/ in the open_basedir configuration in php.ini will solve your problem.

I suggest you better configure your development environment, because everything indicates this your project has this directory in open_basedir: C:/Inetpub/vhosts/matriculanglo2.com.br/

  • I put "None" in open_basedir in php settings and it worked! thanks

Browser other questions tagged

You are not signed in. Login or sign up in order to post.