CodeIgniter Forums

Full Version: Help Message: Trying to get property of non-object!!!!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi guys 

i  have a strange issue

i have 2 servers setup with the same codeigniter version and code, one works and the other does not.. which is more strange

but ok this is the error i am getting

A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: controllers/statut.php
Line Number: 32


lets check the file code



PHP Code:
<?php
/**

 */

class Statut extends Controller {
    public function __construct() {
        parent::Controller();
        $this->load->model('tuner_model');
        $this->load->model('chaine_model');
        $this->load->model('config_model');
        $this->load->helper('url');
        $this->load->helper('exec');
        $this->load->helper('toolbox');
        $this->load->database('db');
    }

    public function index($status=''$type='') {
        $data['tuners'] = $this->tuner_model->findAll();
        
        $this
->load->view('header');
        $this->load->view('navigation');
        $this->load->view('statut/index'$data);
        $this->load->view('footer');
    }
    
    
public function info($id) {
        $transponder $this->tuner_model->find($id);
        $data['transponder'] = $transponder->name;
        $num_card $transponder->num_card;
        $http_port $this->config_model->findOneByName('port_http');
        $port $http_port->value+$num_card;
        $ip $this->config_model->findOneByName('ip_http');
        if (@fopen("http://".$ip->value.":".$port."/monitor/state.xml""r")) {
                
            $dom 
= new DomDocument;
            $dom->load('http://'.$ip->value.':'.$port.'/monitor/state.xml');                
                $data
['card_path'] = $dom->getElementsByTagName('card_path');
            $data['chaines'] = $dom->getElementsByTagName('name');
                $data['pcr_pid'] = $dom->getElementsByTagName('pcr_pid');
                $data['ratio_scrambled'] = $dom->getElementsByTagName('ratio_scrambled');
                $data['service_id'] = $dom->getElementsByTagName('service_id');        
                $data
['pmt_version'] = $dom->getElementsByTagName('pmt_version');
            $data['ip_multicast'] = $dom->getElementsByTagName('ip_multicast');
            $data['port_multicast'] = $dom->getElementsByTagName('port_multicast');
            $data['traffic'] = $dom->getElementsByTagName('traffic');
            $data['chaines'] = $dom->getElementsByTagName('name');
            $data['version'] = $dom->getElementsByTagName('global_version');
            $data['uptime'] = $dom->getElementsByTagName('global_uptime');
            $data['signal'] = $dom->getElementsByTagName('frontend_signal');
        
$data['snr'] = $dom->getElementsByTagName('frontend_snr');
                $data['frontend_name'] = $dom->getElementsByTagName('frontend_name');
                $data['unicast_client_count'] = $dom->getElementsByTagName('unicast_client_count');
                $data['remote_address'] = $dom->getElementsByTagName('remote_address');
                $data['remote_port'] = $dom->getElementsByTagName('remote_port');

                
            
        
}
        else {
            $data['err'] = true;
        }
        $this->load->view('popup');
        $this->load->view('statut/info'$data);
    }
    
    public function startAll() {
        exec('sudo /etc/init.d/iptvmiddleware start');
        redirect('statut/wait');
    }
    
    public function stopAll() {
        exec('sudo /etc/init.d/iptvmiddleware stop');
        redirect('statut/wait');
    }
    
    
public function start($id) {
        $tuner $this->tuner_model->find($id);        
        exec
('sudo /etc/init.d/iptvmiddleware start '.strtolower($tuner->name));
        redirect('statut/wait');
    }
    
    
public function stop($id) {
        $tuner $this->tuner_model->find($id);        
        exec
('sudo /etc/init.d/iptvmiddleware stop '.strtolower($tuner->name));
        redirect('statut/wait');
    }
    
    
public function wait() {
        $this->load->view('header');
        $this->load->view('navigation');
        $this->load->view('statut/wait');
        $this->load->view('footer');
    }


line 32 of the code is 


PHP Code:
    $http_port $this->config_model->findOneByName('port_http'); 

Basically it pulls the information of the IP and port  to fetch the following data from  ip:port/monitor/state.xml  file

or at least it was supposed to do it , but its not..


this is the real file on the server with problems ok so it searches for the information from the xml, and displays it on PHP info file on the WEBGUI from the middleware server but for some reason its not picking up the information necessary.

Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<iptvmiddleware card="20" frontend="0">
<card_path><![CDATA[/dev/dvb/adapter20]]></card_path>
    <global_version><![CDATA[2.1.0_20180602_iptvmiddleware]]></global_version>
    <global_pid>26057</global_pid>
    <global_uptime>91723</global_uptime>
    <frontend_name><![CDATA[TurboSight TBS 6909 DVB-S/S2 ]]></frontend_name>
    <frontend_tuned>1</frontend_tuned>
    <frontend_frequency>0</frontend_frequency>
    <frontend_satnumber>0</frontend_satnumber>
    <frontend_polarization><![CDATA[H]]></frontend_polarization>
    <frontend_symbolrate>4686000</frontend_symbolrate>
    <frontend_system><![CDATA[DVB-S2]]></frontend_system>
    <frontend_status><![CDATA[SCVYL]]></frontend_status>
    <frontend_ber>0</frontend_ber>
    <frontend_signal>31488</frontend_signal>
    <frontend_snr>45592</frontend_snr>
    <frontend_ub>0</frontend_ub>
    <ts_discontinuities>0</ts_discontinuities>
    <autoconfiguration>0</autoconfiguration>
    <cam_support>0</cam_support>
    <cam_number>0</cam_number>
    <cam_menustring><![CDATA[Not retrieved]]></cam_menustring>
    <cam_initialized>0</cam_initialized>
    <scam_support>0</scam_support>
    <ring_buffer_default_size>0</ring_buffer_default_size>
    <decsa_default_delay>0</decsa_default_delay>
    <send_default_delay>0</send_default_delay>
    <channel number="1" is_up="1">
        <lcn>0</lcn>
        <name><![CDATA[Esporte interativo]]></name>
        <service_type type="0"><![CDATA[Please report : Unknown service type doc : EN 300 468 v1.13.1 table 87]]></service_type>
        <ip_multicast><![CDATA[]]></ip_multicast>
        <port_multicast>1234</port_multicast>
        <traffic>1086</traffic>
        <ratio_scrambled>0</ratio_scrambled>
        <service_id>32000</service_id>
        <pmt_pid>0</pmt_pid>
        <pmt_version>0</pmt_version>
        <pcr_pid>0</pcr_pid>
        <unicast_port>1028</unicast_port>
        <unicast_client_count>1</unicast_client_count>
        <ca_sys>
        </ca_sys>
        <pids>
            <pid number="400" language="" scrambled="0"><![CDATA[Unknown]]></pid>
            <pid number="256" language="" scrambled="0"><![CDATA[Unknown]]></pid>
            <pid number="258" language="" scrambled="0"><![CDATA[Unknown]]></pid>
            <pid number="257" language="" scrambled="0"><![CDATA[Unknown]]></pid>
        </pids>
        <clients count="1">
            <client number="0">
                <socket>17</socket>                <remote_address><![CDATA[134.144.145.46]]></remote_address>
                <remote_port>22282</remote_port>                <buffersize>0</buffersize>
                <consecutive_errors>0</consecutive_errors>
                <first_error_time>1534548566</first_error_time>
                <last_write_error>0</last_write_error>
            </client>
        </clients>
    </channel>
</iptvmiddleware>


and this is the monitor.xml file from another server running fine with the same exact status.php file

both servers running same OS version, same php version, etc.etc.etc. , just different channels being streamed.



Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<iptvmiddleware card="13" frontend="0">
<card_path><![CDATA[/dev/dvb/adapter13]]></card_path>
    <global_version><![CDATA[2.1.0_20180602_iptvmiddleware]]></global_version>
    <global_pid>28170</global_pid>
    <global_uptime>15181</global_uptime>
    <frontend_name><![CDATA[TurboSight TBS 6909 DVB-S/S2 ]]></frontend_name>
    <frontend_tuned>1</frontend_tuned>
    <frontend_frequency>0</frontend_frequency>
    <frontend_satnumber>0</frontend_satnumber>
    <frontend_polarization><![CDATA[H]]></frontend_polarization>
    <frontend_symbolrate>3214000</frontend_symbolrate>
    <frontend_system><![CDATA[DVB-S]]></frontend_system>
    <frontend_status><![CDATA[SCVYL]]></frontend_status>
    <frontend_ber>0</frontend_ber>
    <frontend_signal>29520</frontend_signal>
    <frontend_snr>43624</frontend_snr>
    <frontend_ub>0</frontend_ub>
    <ts_discontinuities>0</ts_discontinuities>
    <autoconfiguration>0</autoconfiguration>
    <cam_support>0</cam_support>
    <cam_number>0</cam_number>
    <cam_menustring><![CDATA[Not retrieved]]></cam_menustring>
    <cam_initialized>0</cam_initialized>
    <scam_support>0</scam_support>
    <ring_buffer_default_size>0</ring_buffer_default_size>
    <decsa_default_delay>0</decsa_default_delay>
    <send_default_delay>0</send_default_delay>
    <channel number="1" is_up="1">
        <lcn>0</lcn>
        <name><![CDATA[TV SENADO]]></name>
        <service_type type="0"><![CDATA[Please report : Unknown service type doc : EN 300 468 v1.13.1 table 87]]></service_type>
        <ip_multicast><![CDATA[239.106.13.0]]></ip_multicast>
        <port_multicast>4013</port_multicast>
        <traffic>465</traffic>
        <ratio_scrambled>0</ratio_scrambled>
        <service_id>1</service_id>
        <pmt_pid>0</pmt_pid>
        <pmt_version>0</pmt_version>
        <pcr_pid>0</pcr_pid>
        <unicast_port>0</unicast_port>
        <unicast_client_count>0</unicast_client_count>
        <ca_sys>
        </ca_sys>
        <pids>
            <pid number="1792" language="" scrambled="0"><![CDATA[Unknown]]></pid>
            <pid number="1110" language="" scrambled="0"><![CDATA[Unknown]]></pid>
            <pid number="1211" language="" scrambled="0"><![CDATA[Unknown]]></pid>
            <pid number="1213" language="" scrambled="0"><![CDATA[Unknown]]></pid>
            <pid number="150" language="" scrambled="0"><![CDATA[Unknown]]></pid>
        </pids>
        <clients count="0">
        </clients>
    </channel>
</iptvmiddleware>


so i am freaking lost.. not shure i am running out of ideas , the only difference is this


1st picture server not working

2nd picture server working




The only difference i have seen is that  server working fine has PHP5.6.37 version  with Xdebug v2.5.5, Copyright © 2002-2017, by Derick Rethans




and the one not working has the same PHP 5.6.37 version but without xdebug.. its the only difference i could see so far..

Any help, hints or ideas are welcome ...

Thxs
This sounds like a classic Widows vs Linux case sensitivity issue, especially given your filename "controllers/statup.php". CI looks for controllers/Statup.php, and wil find it on Windows but not on Linux.
You said that are running the same OS on both servers, leading me to surmise that one is configured to enforce case sensitivity and the other not.

The other thing you might look for is different environment config folders, eg application/config/production
(08-17-2018, 09:34 PM)ciadmin Wrote: [ -> ]This sounds like a classic Widows vs Linux case sensitivity issue, especially given your filename "controllers/statup.php". CI looks for controllers/Statup.php, and wil find it on Windows but not on Linux.
You said that are running the same OS on both servers, leading me to surmise that one is configured to enforce case sensitivity and the other not.

The other thing you might look for is different environment config folders, eg application/config/production

Hiya 

thanks for your reply


both servers running ubuntu-server x64 16.04 , so both linux dedicated servers..


And same exact config folders for both machines, its standard practise to avoid silly mistakes, or at least it was supposed to.


so how would i approach it to find out the case sensitivy?