CodeIgniter Forums
CI 3.1.5 php Warning shell_exec - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: CI 3.1.5 php Warning shell_exec (/showthread.php?tid=68967)



CI 3.1.5 php Warning shell_exec - moshair - 09-21-2017

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,


RE: CI 3.1.5 php Warning shell_exec - rtenny - 09-21-2017

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.


RE: CI 3.1.5 php Warning shell_exec - moshair - 09-21-2017

(09-21-2017, 04: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'); 



RE: CI 3.1.5 php Warning shell_exec - Paradinight - 09-21-2017

(09-21-2017, 08:29 AM)moshair Wrote:
(09-21-2017, 04: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


RE: CI 3.1.5 php Warning shell_exec - skunkbad - 09-21-2017

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');



RE: CI 3.1.5 php Warning shell_exec - moshair - 09-22-2017

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,


RE: CI 3.1.5 php Warning shell_exec - Boreas - 11-25-2020

(09-21-2017, 02:48 AM)mosI hair Wrote: Hi there
Big Grin  I had the same thing.
Its the backticks in this bit of code
$this->db->order_by(`views`, 'asc');

I hope that helps someone. Took me a while to figure out where I'd gone wrong.

Cheers


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,



RE: CI 3.1.5 php Warning shell_exec - InsiteFX - 11-27-2020

Your using escaping charters on view it should be double or single quotes.

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

// change to this and see if it works
$this->db->order_by('views''asc'); 

Just a hunch.