• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CI 3.1.5 php Warning shell_exec

#1
Hello,

I got this warning:

Quote:A PHP Error was encountered

Severity: Warning

Message: shell_exec() has been disabled for security reasons

Filename: models/Magazine_model.php

Line Number: 82

Backtrace:

File: /home/****/public_html/application/models/Magazine_model.php
Line: 82
Function: shell_exec

File: /home/****/public_html/application/controllers/Magazine.php
Line: 29
Function: get_highest_views_posts

File: /home/***/public_html/index.php
Line: 315
Function: require_once

First I thought files are infected with bad virus codes, I found shell_exec exists in the file
system/libraries/upload.php

I didn't use any shell_exec command or upload operations. this is the model function centent:

PHP Code:
function get_highest_views_posts() {
    
$this->db->select('fid,tid,subject,dateline,replies,views,visible,username,closed');
    
$this->db->order_by(`views`, 'asc');
    
$this->db->where_in('closed', Array('0','1',''));
    
$this->db->where_not_in('fid'$this->config->item('private_forums'));
    
$this->db->limit($this->config->item('posts_views_limit'));
    
$query $this->db->get('threads');
    return 
$query->result();
  } 

Is there another solution to solve this than setting environment to production to hide warnings?

Regards,
Reply

#2
in system CI checks if su_exec can be used. You should not see an error.
The error message tell you the problem is in you model file. Not in system/libary/upload.php.

Filename: models/Magazine_model.php
Line Number: 82

I doubt very much that the upload.php is your problem.
On the package it said needs Windows 7 or better. So I installed Linux.
Reply

#3
(09-21-2017, 05:32 AM)rtenny Wrote: in system CI checks if su_exec can be used. You should not see an error.
The error message tell you the problem is in you model file. Not in system/libary/upload.php.

Filename: models/Magazine_model.php
Line Number: 82

I doubt very much that the upload.php is your problem.

Thank you, this is line 82

PHP Code:
$this->db->order_by(`views`, 'asc'); 
Reply

#4
(09-21-2017, 09:29 AM)moshair Wrote:
(09-21-2017, 05:32 AM)rtenny Wrote: in system CI checks if su_exec can be used. You should not see an error.
The error message tell you the problem is in you model file. Not in system/libary/upload.php.

Filename: models/Magazine_model.php
Line Number: 82

I doubt very much that the upload.php is your problem.

Thank you, this is line 82

PHP Code:
   $this->db->order_by(`views`, 'asc'); 

check the file from live server
Reply

#5
You probably don't have any control over it, but your host has most likely disabled shell_exec along with a bunch of other functions that they deem dangerous. If that's the case, then in the php.ini file shell_exec is probably listed in disabled_functions. If that's the case, and it looks like it is, you'll have to use a different function, ask the host to allow usage of the function, or change to a host that allows it. Best case scenario is that you have the ability to allow the function because you can modify php.ini and restart apache.

Just for kicks, see the output of:


Code:
echo ini_get('disable_functions');
Reply

#6
Thanks skunkbad,

I checked the application files; I'm sure that I didn't use shell_exec command or upload library.

The problem is on my friends website, I want to insure that it is not related to CI, My theory was the server is infected with viruses that add codes to the php files. So he should check the files on the server.

Regards,
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.