Welcome Guest, Not a member yet? Register   Sign In
non-object Error
#1

Hi,
I'm new on the forum and I don't know I'm writing in correct place Smile
I passed Ubuntu yesterday and my Codeigniter projects give a lot of errors. (I'm using PHP 5.5.6) I clean some of that but I'm getting an error and I can't clean it. (It's on the attachment) Can you help me? Thanks...

Attached Files Thumbnail(s)
   
Reply
#2

(This post was last modified: 03-12-2017, 04:00 AM by InsiteFX. Edit Reason: version error fixed )

The CodeIgniter recommends PHP version 5.6 or above.

Try upgrading your PHP version.

I'am running PHP version 7.1.1
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(03-12-2017, 04:00 AM)InsiteFX Wrote: The CodeIgniter recommends PHP version 5.6 or above.

Try upgrading your PHP version.

I'am running PHP version 7.1.1

And while that is true, if you actually looked at the error you'd see it has nothing to do with the PHP version.
Reply
#4

(03-12-2017, 01:59 AM)UygarDemirKoç Wrote: Hi,
I'm new on the forum and I don't know I'm writing in correct place Smile
I passed Ubuntu yesterday and my Codeigniter projects give a lot of errors. (I'm using PHP 5.5.6) I clean some of that but I'm getting an error and I can't clean it. (It's on the attachment) Can you help me? Thanks...

Does your Start controller extend CI_Controller, e.g:
PHP Code:
class Start extends CI_Controller
{

Reply
#5

Make sure that you have a constructor also.

PHP Code:
class Start extends CI_Controller
{

 
   public function __construct()
 
   {
 
       parent::__construct();
 
   }


What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#6

(03-12-2017, 09:28 AM)InsiteFX Wrote: Make sure that you have a constructor also.

PHP Code:
class Start extends CI_Controller
{

 
   public function __construct()
 
   {
 
       parent::__construct();
 
   }



A constructor that only calls its parent constructor is completely pointless.
Reply
#7

(This post was last modified: 03-12-2017, 04:33 PM by marksman.)

Maybe you are calling on a property that is not defined, you may be do some verification before calling a property something like
PHP Code:
property_exists(__CLASS__'propertyName'
and as a friendly advice if you have your own autoloader put it in your autoloader, your autoloader is the best location where you will have to define those properties and to be accessible by your class.
for example you have your MY_Autoloader that extends to you CI_Controller and your controller extends to MY_Autoloader or it depends how you name it. In this case the property has been set automatically before your controller has been loaded. Goodluck. Smile

Just take note, using $this and static are different instance.
God Bless CI Contributors Smile
Reply
#8

I tried to install PHP7 with Apache2. It's working right now. Thanks, the problem is solved Smile
Reply




Theme © iAndrew 2016 - Forum software by © MyBB