Function returning Warning open_basedir Restriction in Effect. File

Asked

Viewed 2,137 times

1

I have a PHP function that checks if I have new requests on the system. if you have with the return in ajax I display a notification toas displayed the order number.

PHP function checkNovoPedido.php

<?php
include('../../class/mysql_crud.php');

$pedido = 0;


$db = new Database();
$db->connect();
$db->sql("SELECT * FROM lanc_pedidos WHERE status='1' and notificado='0'");
$res = $db->numRows();
    if ($res >= 1){
      $res = $db->getResult();
      foreach ($res as $output) {
        $pedido = $output["guid"];
      }

 $db->update('lanc_pedidos', array('notificado'=>1), 'guid='.$pedido);
 $res = $db->getResult();
 } else {
   $pedido = 0;
 }

if ($pedido > 10){
  echo 0;
} else {
  echo ($pedido);
}

Ajax function

var timeout = setTimeout(verificaNovoPedido, 2000);
function verificaNovoPedido(){
  $.ajax({
    url: "ajax/pedidos/verificaNovoPedido.php",
    type: "POST",
    success: function (dados){
      if (dados != 0){
        notifyMe(dados);
        reloadtableAllPedido();
      }
    }
  })
  timeout = setTimeout(verificaNovoPedido, 2000);
}

The Problem is that sometimes returning a Warning, in case this:

Request Received, Num:
Warning: include() [Function.include]: open_basedir Restriction in Effect. File(/home/u312527797/public_html/panel/class/mysql_crud.php) is not Within the allowed path(s): (/home/u702782028:/tmp:/var/tmp:/opt/php-5.3/Pear:/usr/local/bin) in /home/u312527797/public_html/panel/ajax/requests/checkNovoPedido.php online 2

Warning: include(/home/u312527797/public_html/panel/class/mysql_crud.php) [Function.include]: failed to open stream: Operation not permitted in /home/u312527797/public_html/panel/ajax/requests/checkNovoPedido.php online 2

Warning: include() [Function.include]: Failed Opening '.. /.. /class/mysql_crud.php' for inclusion (include_path='.:/opt/php-5.3/Pear') in /home/u312527797/public_html/panel/ajax/requests/checkNovoPedido.php online 2

Fatal error: Class 'Database' not found in /home/u312527797/public_html/panel/ajax/requests/checkNovoPedido.php online 7
to view clickWarning: include() [Function.include]: open_basedir Restriction in Effect. File(/home/u312527797/public_html/panel/class/mysql_crud.php) is not Within the allowed path(s): (/home/u702782028:/tmp:/var/tmp:/opt/php-5.3/Pear:/usr/local/bin) in /home/u312527797/public_html/panel/ajax/requests/checkNovoPedido.php online 2

Warning: include(/home/u312527797/public_html/panel/class/mysql_crud.php) [Function.include]: failed to open stream: Operation not permitted in /home/u312527797/public_html/panel/ajax/requests/checkNovoPedido.php online 2

Warning: include() [Function.include]: Failed Opening '.. /.. /class/mysql_crud.php' for inclusion (include_path='.:/opt/php-5.3/Pear') in /home/u312527797/public_html/panel/ajax/requests/checkNovoPedido.php online 2

Fatal error: Class 'Database' not found in /home/u312527797/public_html/panel/ajax/requests/checkNovoPedido.php online 7
);' class='btn btn-Outline-info btn-Sm'>Here

Could someone help me solve this problem ? Obrigaod

1 answer

2


Edit your httpd.conf file ( /etc/httpd/httpd.conf ). Look for "open_basedir" and set it to "None" (php_admin_value open_basedir None)

In its line 2 the include fails and this generates a series of errors.

Source

  • I can do this via Putty ?

  • 1

    Yes, if you edit the file using vi or vim. You also need to know which folder the httpd.conf file is located in, because it varies according to apache’s location.

  • to edit a file with vi/ vim by Putty you can use sudo vim /address/do/file.txt. Are you using windows or linux? has some clients who facilitate access to files.

  • I’m using windows, but I don’t know if the hosting I’m using of the permission to go up these files

  • Since hosting is shared, probably not! The way will be to move the file called by include (or a copy of it) to a folder that you have read permission for.

  • right, the weird one that works the function. just once while this problem happens. every two hours

  • Since you are not the server administrator the way will be to open a ticket with your hosting.

  • I just talked to them. they said that it is not possible to change such settings... what I did was not display the error. I know it’s just returned the request guid that won’t have a big extension. i compared sizes and only display the notification when actually a request. so it will not display the error on the screen at least

Show 3 more comments

Browser other questions tagged

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