Compdigitec Labs

« | Home | »

Stopping the “PHP Fatal error: Internal object missing in” error in PHP-GTK2

By admin | August 16, 2008

In PHP-GTK2, if you build your own class of an existing PHP-GTK2 class, you may encounter one of the following errors:

This is somehow (not documented) caused by not calling parent::__construct(), the parent constructor. For example, try to run the following snippet:
<?php
if (!class_exists(‘gtk’)) {
die(
“ERROR: No PHP-GTK2 Module.\n”);
}

class Myclassw extends GtkWindow {
protected $label;

function __construct() {
$label = new GtkLabel(“Hello World – will fail”);
$this
->add($label);

$this->show();
$this->show_all();

Gtk::main();
}
}
$a = new Myclassw();
?>
You should receive the following errors: (path may be different)

Now, try this snippet:

<?php
if (!class_exists('gtk')) {
die(
"ERROR: No PHP-GTK2 Module.\n");
}
class
Myclassw extends GtkWindow {
protected
$label;

function __construct() {
parent::__construct(); // New line inserted here

$label = new GtkLabel(“Hello World – will work!”);
$this->add($label);
$this->show();
$this->show_all();
Gtk::main();
}
}
$a = new Myclassw();
?>
Now this time, it should work as expected. If you encounter “ERROR: No PHP-GTK2 module.”, this means that you are either running it in your web server or ran it without php-gtk2.(so/dll) in your php.ini.

All tests were ran on Ubuntu Linux 8.04, PHP 5.2.4-2ubuntu5.3 and Linux kernel version 2.6.24-19-generic. If this article helped you solve the problem, please help us spread the word or please leave a comment. Don’t forget to subscribe to Compdigitec Labs for more interesting articles!

If you found this article helpful or interesting, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more useful and interesting articles!

Topics: Linux, PHP, Windows | 12 Comments »

12 Responses to “Stopping the “PHP Fatal error: Internal object missing in” error in PHP-GTK2”

  1. การเพิ่มยอดไลค์มีความสำคัญ Says:
    March 29th, 2025 at 16:49

    … [Trackback]

    […] Info on that Topic: compdigitec.com/labs/2008/08/16/stopping-php-fatal-error-internal-object-missing-in-error-in-php-gtk2/ […]

  2. Winstar auto มีบริการอะไรบ้าง? Says:
    April 1st, 2025 at 00:43

    … [Trackback]

    […] Read More Info here to that Topic: compdigitec.com/labs/2008/08/16/stopping-php-fatal-error-internal-object-missing-in-error-in-php-gtk2/ […]

  3. pg168 Says:
    April 9th, 2025 at 07:31

    … [Trackback]

    […] Find More on on that Topic: compdigitec.com/labs/2008/08/16/stopping-php-fatal-error-internal-object-missing-in-error-in-php-gtk2/ […]

  4. บาคาร่า ufa11k Says:
    April 11th, 2025 at 05:01

    … [Trackback]

    […] Information on that Topic: compdigitec.com/labs/2008/08/16/stopping-php-fatal-error-internal-object-missing-in-error-in-php-gtk2/ […]

  5. Off Track Garage Door Repair in Portland, OR Says:
    April 14th, 2025 at 06:10

    … [Trackback]

    […] Information to that Topic: compdigitec.com/labs/2008/08/16/stopping-php-fatal-error-internal-object-missing-in-error-in-php-gtk2/ […]

  6. รับติดตั้งระบบระบายอากาศ Says:
    April 17th, 2025 at 22:08

    … [Trackback]

    […] Find More Information here on that Topic: compdigitec.com/labs/2008/08/16/stopping-php-fatal-error-internal-object-missing-in-error-in-php-gtk2/ […]

  7. โคมไฟ Says:
    April 17th, 2025 at 22:57

    … [Trackback]

    […] Find More Information here on that Topic: compdigitec.com/labs/2008/08/16/stopping-php-fatal-error-internal-object-missing-in-error-in-php-gtk2/ […]

  8. headphone for gaming hyderabad Says:
    May 3rd, 2025 at 08:44

    … [Trackback]

    […] Find More on that Topic: compdigitec.com/labs/2008/08/16/stopping-php-fatal-error-internal-object-missing-in-error-in-php-gtk2/ […]

  9. ปริ้นโปสการ์ด Says:
    May 5th, 2025 at 20:25

    … [Trackback]

    […] Info to that Topic: compdigitec.com/labs/2008/08/16/stopping-php-fatal-error-internal-object-missing-in-error-in-php-gtk2/ […]

  10. ชุดกระชับสัดส่วน Says:
    May 10th, 2025 at 01:51

    … [Trackback]

    […] Find More here on that Topic: compdigitec.com/labs/2008/08/16/stopping-php-fatal-error-internal-object-missing-in-error-in-php-gtk2/ […]

  11. instalação cablagem informática Says:
    May 21st, 2025 at 15:27

    … [Trackback]

    […] Here you can find 3082 more Information to that Topic: compdigitec.com/labs/2008/08/16/stopping-php-fatal-error-internal-object-missing-in-error-in-php-gtk2/ […]

  12. รับงานเอง Says:
    June 26th, 2025 at 14:12

    … [Trackback]

    […] Here you can find 29462 additional Information to that Topic: compdigitec.com/labs/2008/08/16/stopping-php-fatal-error-internal-object-missing-in-error-in-php-gtk2/ […]

Comments