Problems with permission

0

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

If I change the path of hosting the site itself it can 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\pedidos54_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\pedidos54_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
    
asked by anonymous 01.12.2017 / 19:00

1 answer

0

Hello, by checking the error message we have:

  

Message: fopen (): open_basedir restriction in effect.

Searching on open_basedir, I came to this link: link

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 configuration of open_basedir in php.ini will solve your problem.

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

    
01.12.2017 / 20:57