Page 1 of 2
Class __construct
Posted: Mon Jul 10, 2006 6:09 am
by kahwooi
Pimptastic | Please use Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Can I do this? I get an error, is there a better way to do it? Thank You.
Code: Select all
class test{
public function __construct(){
$this->testing = new testing();
}
}
class testing{
public function __construct(){
$this->test = new test();
}
}
Pimptastic | Please use Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Posted: Mon Jul 10, 2006 6:17 am
by technofreak
What are you trying to do with that code ?
Posted: Mon Jul 10, 2006 6:23 am
by kahwooi
So that I can use the functions in testing class from test class and vice versa.
Thanks for your reply.
Posted: Mon Jul 10, 2006 6:25 am
by Jenk
Code: Select all
<?php
class Test
{
private $testing;
public function __construct ()
{
$this->testing = new testing();
}
}
class Testing
{
private $test;
public function __construct ()
{
$this->test = new test();
}
}
$test = new Test;
$testing = new Testing;
?>
Posted: Mon Jul 10, 2006 6:29 am
by kahwooi
I get Internal Server Error after running Jenk's code with the following message:
The server encountered an internal error or misconfiguration and was unable to complete your request.
Thank you Jenk for helping out.
Posted: Mon Jul 10, 2006 6:37 am
by Chris Corbyn
kahwooi wrote:I get Internal Server Error after running Jenk's code with the following message:
The server encountered an internal error or misconfiguration and was unable to complete your request.
Thank you Jenk for helping out.
Sounds like Apache or PHP is not installed/configured correctly. The code is fine

Posted: Mon Jul 10, 2006 6:41 am
by kahwooi
Anyone has any clue what I had done wrong with my setting?
I'm clueless!!!!
Posted: Mon Jul 10, 2006 6:48 am
by kahwooi
Is the code from Jenk working?
Posted: Mon Jul 10, 2006 6:50 am
by Jenk
I've noticed a couple typo's in my post.. though they shouldn't be the cause of your server error:
Code: Select all
<?php
class Test
{
private $testing;
public function __construct ()
{
$this->testing = new Testing();
}
}
class Testing
{
private $test;
public function __construct ()
{
$this->test = new Test();
}
}
$test = new Test;
$testing = new Testing;
?>
Posted: Mon Jul 10, 2006 6:58 am
by kahwooi
So is apache problem or php??? Thank you Jenk!
Posted: Mon Jul 10, 2006 6:59 am
by Jenk
either/or in all reality.
Is this hosted or local?
Posted: Mon Jul 10, 2006 7:01 am
by kahwooi
it is local, I'm using php 5.1.2 and Apache 2.0.55
Posted: Mon Jul 10, 2006 7:44 am
by kahwooi
Are you all using php 5.1.2 and Apache 2.0.55? I reinstalled the PHP and Apache, but I'm facing the same problem.
Posted: Mon Jul 10, 2006 8:04 am
by kahwooi
This is what I get from error log:
Premature end of script headers: php-cgi.exe
Posted: Mon Jul 10, 2006 8:13 am
by Jenk
google returns the below when searching for the error message..
i couldn't get it work as well. I would receive "Today is //". This is what I did to correct the problem. 1)I'm using Win XP pro Service pack 1, PHP 5.0.3RC1, Apache 2.0.52. I did not move the "php5ts.dll" to c:\windows BUT to c:\windows\system32. 2) Go to this PHP link and follow the directions on this page
http://www.php.net/manual/en/install.wi ... pache2.php 3) Next edit the index.php file you created in step 1(above)and delete the line and replace it with <?php phpinfo () ; ?> then save this file. Then open
http://localhost you should have a graphical list of all your PHP info this file is much more useful then the file above. If it did not work then you need to go through the step 6 Configuring PHP5 with Apache (UP TO STEP 4 ONLY) then follow the link I have above and double check your settings again. Good Luck hope works for you. I spent 2 days trying to get this thing to work.