S_M_E Posted November 19, 2008 Share Posted November 19, 2008 I know next to nothing about PHP and I have two pages that are giving me fits. They work on newer PHP5 but they display blank, with errors in the log, on PHP4. I assume they've changed the syntax but I'm completely lost. [Wed Nov 19 09:56:20 2008] [error] PHP Parse error: syntax error, unexpected ',', expecting '(' in /hsphere/local/home/etc/etc.php on line 8 Here is line 8: if(mail(MainConfig::$mail, "Contact Us","$_POST[comments]")) Another page has the same error in the log on a different line: $file = fopen(MainConfig::$filename, "r"); If that's not enough information I can include more of the code, I just thought I'd keep this post small, if possible. It appears that it doesn't like "(MainConfig::$etc, " on either line but I have no idea how to fix it so it'll work with older PHP and newer PHP. I'd appreciate any help. TIA... Link to comment https://forums.phpfreaks.com/topic/133420-solved-syntax-errors-completely-confused/ Share on other sites More sharing options...
redarrow Posted November 19, 2008 Share Posted November 19, 2008 look at my sig ok......... mail working....... Link to comment https://forums.phpfreaks.com/topic/133420-solved-syntax-errors-completely-confused/#findComment-693926 Share on other sites More sharing options...
redarrow Posted November 19, 2008 Share Posted November 19, 2008 what in this please MainConfig: Link to comment https://forums.phpfreaks.com/topic/133420-solved-syntax-errors-completely-confused/#findComment-693927 Share on other sites More sharing options...
S_M_E Posted November 19, 2008 Author Share Posted November 19, 2008 Actually, the first one is part of a contact form, the second one takes names from a text file and displays them on the page. If you need more of the code because my post didn't make sense: <?php $email_sent = 0; if(isset($_POST["contact"])){ require("./config.php"); if(mail(MainConfig::$mail, "Contact Us","$_POST[comments]")) $email_sent = 1; } ?> The second one: <?php include("./config.php"); $file = fopen(MainConfig::$filename, "r"); if($file){ while($line = fgets($file)){ ?> <h3><?php echo "$line"; ?></h3> <?php } } ?> Hope that makes more sense but I'm still lost. Link to comment https://forums.phpfreaks.com/topic/133420-solved-syntax-errors-completely-confused/#findComment-693930 Share on other sites More sharing options...
Mchl Posted November 19, 2008 Share Posted November 19, 2008 Seems to be some kind of static registry class. I'm not sure PHP4's object model has static classes implemented, but from skimming through manual it doesn't seem so. In such case this code would require some serious work to port it to PHP4 Link to comment https://forums.phpfreaks.com/topic/133420-solved-syntax-errors-completely-confused/#findComment-693933 Share on other sites More sharing options...
redarrow Posted November 19, 2008 Share Posted November 19, 2008 You got me post the whole script please........... Link to comment https://forums.phpfreaks.com/topic/133420-solved-syntax-errors-completely-confused/#findComment-693935 Share on other sites More sharing options...
S_M_E Posted November 19, 2008 Author Share Posted November 19, 2008 In such case this code would require some serious work to port it to PHP4 That's what I was afraid of. I doubt the hosting company will upgrade to PHP5 anytime soon either... Link to comment https://forums.phpfreaks.com/topic/133420-solved-syntax-errors-completely-confused/#findComment-693937 Share on other sites More sharing options...
redarrow Posted November 19, 2008 Share Posted November 19, 2008 MainConfig: << is this part off a class....... Link to comment https://forums.phpfreaks.com/topic/133420-solved-syntax-errors-completely-confused/#findComment-693939 Share on other sites More sharing options...
DarkWater Posted November 19, 2008 Share Posted November 19, 2008 In such case this code would require some serious work to port it to PHP4 That's what I was afraid of. I doubt the hosting company will upgrade to PHP5 anytime soon either... PHP4's end of life support was December '07. Its object model is poorly implemented and lacking in features of most advanced OOP languages. It also lacks several new functions and code revisions. No hosting company should still be using PHP4. Switch companies or write them a nice big e-mail explaining why they should use PHP5. Link to comment https://forums.phpfreaks.com/topic/133420-solved-syntax-errors-completely-confused/#findComment-693941 Share on other sites More sharing options...
Mchl Posted November 20, 2008 Share Posted November 20, 2008 Upgrade your hosting company then. If they still don't have PHP5 they're like in stone age of hosting companies. On the other hand, maybe they do? Better check it. Some hosting companies have actually two versions of PHP running at one time, and to use PHP5 you have to save your files as *.php5 On the third hand: I might be wrong. Link to comment https://forums.phpfreaks.com/topic/133420-solved-syntax-errors-completely-confused/#findComment-693942 Share on other sites More sharing options...
DarkWater Posted November 20, 2008 Share Posted November 20, 2008 Upgrade your hosting company then. If they still don't have PHP5 they're like in stone age of hosting companies. On the other hand, maybe they do? Better check it. Some hosting companies have actually two versions of PHP running at one time, and to use PHP5 you have to save your files as *.php5 On the third hand: I might be wrong. You have three hands? Lucky. Link to comment https://forums.phpfreaks.com/topic/133420-solved-syntax-errors-completely-confused/#findComment-693944 Share on other sites More sharing options...
S_M_E Posted November 20, 2008 Author Share Posted November 20, 2008 MainConfig: << is this part off a class....... Yes, both pages read from config.php to get the name of the file to read from and to get the email address to use for the contact form: <?php // SET THE CONTACT US EMAIL IN THIS LINE MainConfig::set_email("[email protected]"); //SET THE DISPLAY TXT FILE PATH IN THIS LINE MainConfig::set_display("text.txt"); class MainConfig{ static $mail = ""; static $filename = ""; static function set_email($email){ self::$mail = $email; } static function set_display($filename){ self::$filename = $filename; } } ?> Link to comment https://forums.phpfreaks.com/topic/133420-solved-syntax-errors-completely-confused/#findComment-693946 Share on other sites More sharing options...
DarkWater Posted November 20, 2008 Share Posted November 20, 2008 That class is absolutely useless. Why not just use a regular variable? o_O Link to comment https://forums.phpfreaks.com/topic/133420-solved-syntax-errors-completely-confused/#findComment-693947 Share on other sites More sharing options...
S_M_E Posted November 20, 2008 Author Share Posted November 20, 2008 That class is absolutely useless. Why not just use a regular variable? o_O I didn't write it, I'm just trying to fix it so it'll work. However, it works fine with PHP5 (EDIT) FYI: Apache/1.3.39 (Unix) PHP/4.4.7 mod_throttle/3.1.2 FrontPage/5.0.2.2635 mod_psoft_traffic/0.2 mod_ssl/2.8.29 OpenSSL/0.9.7e-p1 Link to comment https://forums.phpfreaks.com/topic/133420-solved-syntax-errors-completely-confused/#findComment-693949 Share on other sites More sharing options...
redarrow Posted November 20, 2008 Share Posted November 20, 2008 post your form please.............. Link to comment https://forums.phpfreaks.com/topic/133420-solved-syntax-errors-completely-confused/#findComment-693953 Share on other sites More sharing options...
DarkWater Posted November 20, 2008 Share Posted November 20, 2008 post your form please.............. We've already established that it's due to his having PHP4. There's nothing he can do other than refactor/remove those useless classes or upgrade. Link to comment https://forums.phpfreaks.com/topic/133420-solved-syntax-errors-completely-confused/#findComment-693955 Share on other sites More sharing options...
S_M_E Posted November 20, 2008 Author Share Posted November 20, 2008 That's all of the php, the rest is just html. I talked to the hosting company and they don't want to upgrade to php5 becasue some customers have code they think will break and they are worried that their control panel will break with php5 too. They're looking at either adding php5, as mchl suggesting they could, or moving my site to a different server. Either will work for me, I just want the code to work... Thanks guys... Link to comment https://forums.phpfreaks.com/topic/133420-solved-syntax-errors-completely-confused/#findComment-693959 Share on other sites More sharing options...
DarkerAngel Posted November 20, 2008 Share Posted November 20, 2008 I'd give him my emailer that works really well, but it's OOP and requires PHP5 anyways so it won't help him. So like everyone says talk to your hosting provider about PHP5. Link to comment https://forums.phpfreaks.com/topic/133420-solved-syntax-errors-completely-confused/#findComment-693960 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.