PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 21st, 2005, 10:14 PM
PHP beginner PHP beginner is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 8 PHP beginner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 6 m 12 sec
Reputation Power: 0
Unhappy parse error:T_String

Please help.
I get the following error when i lauch my website in the internet. On my localhost everything woks fine, i have no problems at all.

this is the error:

Warning: Wrong parameter count for set_error_handler() in .../include/tss_error_handler.php on line 3

Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in .../include/database.php on line 7


the error handler looks like this on line 1-5:

<?php
// set the user error handler method to be tss_error_handler
set_error_handler("tss_error_handler", E_ALL);
// error handler function
function tss_error_handler($errNo, $errStr, $errFile, $errLine)
{


and my database like that on line 1-9:

<?php
// reference the PEAR DB library
require_once 'DB.php';
// class providing generic data access functionality
class DbManager
{
public $db;
// open database connection in the constructor
function __construct($connectionString)
{


i really don't understand the fact, why it is working on my localhost, but not on the webserver.

please help!!

Reply With Quote
  #2  
Old April 22nd, 2005, 05:12 AM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 1,029 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6
Time spent in forums: 1 Week 12 h 41 m 23 sec
Reputation Power: 15
Send a message via ICQ to Itsacon
The function set_error_handler was changed in PHP version 4.0.2. Before that time, the error handling function had to accept 2 parameters only, errornumber and errorstring.
the next 3 optional parameters, file, line and context of the error, were added in PHP 4.0.2. On localhost you probably run a version newer than 4.0.2, so the $errFile and $errLine are properly supplied to your tss_error_handler function, but I suspect your webserver runs an older version, and tss_error_handler is only supplied 2 arguments, even though it expects 4.
The easy way to find out which version your webserver is running is through the php_info() function.

If it's indeed running an older version, there are two options to solve the problem:
-Update the server
-Make the last 2 parameters of your tss_error_handler function optional, like this:
PHP Code:
function tss_error_handler($errNo$errStr$errFile=''$errLine=0


Hope this helps
__________________
This is my code. Is it not nifty?

"The biggest problem encountered while trying to design a system that was completely foolproof, was, that people tended to underestimate the ingenuity of complete fools."
---Douglas Adams


Join the Itsacon fanclub!    
Zero Tolerance: Spammers banned so far: 592

Last edited by Itsacon : April 22nd, 2005 at 08:33 AM.

Reply With Quote
  #3  
Old April 22nd, 2005, 10:02 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,886 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 19 m 35 sec
Reputation Power: 18
There was a good article written a couple years ago, Making Sense Of PHP errors which might help with some of those "Unexpected Errors".

Reply With Quote
  #4  
Old April 22nd, 2005, 10:36 PM
PHP beginner PHP beginner is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 8 PHP beginner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 6 m 12 sec
Reputation Power: 0
Unhappy

Unfortunatly neither the article nor the other tss_error_handler helped. Do you have any other idea??

I still get the same error.

Reply With Quote
  #5  
Old April 23rd, 2005, 08:31 AM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 1,029 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6
Time spent in forums: 1 Week 12 h 41 m 23 sec
Reputation Power: 15
Send a message via ICQ to Itsacon
What version of PHP ARE you using? Cause the second parameter for set_error_handler() wasn't added till PHP 5, which would explain this error:

Warning: Wrong parameter count for set_error_handler() in .../include/tss_error_handler.php on line 3

try removing the second parameter ('E_ALL'), and see what it does.

Reply With Quote
  #6  
Old April 23rd, 2005, 09:08 AM
PHP beginner PHP beginner is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 8 PHP beginner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 6 m 12 sec
Reputation Power: 0
Cool

Thats great, this part worked now. I get now tss_error-handler error anymore.
I thought the two errors would be contected. Unfortunately not.
Now I only get this Parse error.
As you were so helpful, do you ave any Ideas what that could be?


Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in .../include/database.php on line 7


This is my database.php

<?php
// reference the PEAR DB library
require_once 'DB.php';
// class providing generic data access functionality
class DbManager
{
public $db;
// open database connection in the constructor
function __construct($connectionString)
{
$this->db = DB::connect($connectionString,
USE_PERSISTENT_CONNECTIONS);
if (DB::isError($this->db))
trigger_error($this->db->getMessage(), E_USER_ERROR);
$this->db->setFetchMode(DB_FETCHMODE_ASSOC);
}
// close the connection
public function DbDisconnect()
{
$this->db->disconnect();
}
public function DbQuery($queryString)
{
$result = $this->db->query($queryString);
if (DB::isError($result))
trigger_error($result->getMessage(), E_USER_ERROR);
return $result;
}
// wrapper class for PEAR DB's getAll() method
public function DbGetAll($queryString)
{
$result = $this->db->getAll($queryString);
if (DB::isError($result))
trigger_error($result->getMessage(), E_USER_ERROR);
return $result;
}
// wrapper class for PEAR DB's getRow() method
public function DbGetRow($queryString)
{
$result = $this->db->getRow($queryString);
if (DB::isError($result))
trigger_error($result->getMessage(), E_USER_ERROR);
return $result;
}
// wrapper class for PEAR DB's getOne() method
public function DbGetOne($queryString)
{
$result = $this->db->getOne($queryString);
if (DB::isError($result))
trigger_error($result->getMessage(), E_USER_ERROR);
return $result;
}
// wrapper class for the escapeSimple() method
public function DbEscapeSimple($string)
{
if (get_magic_quotes_gpc())
return $string;
else
return $this->db->escapeSimple($string);
}


}
?>


Thanks

Reply With Quote
  #7  
Old April 23rd, 2005, 09:52 AM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 1,029 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6
Time spent in forums: 1 Week 12 h 41 m 23 sec
Reputation Power: 15
Send a message via ICQ to Itsacon
Same problem, your webserver doesn't run PHP5, and as such uses the OLD class model, which doesn't know what the hell you're talking about.
Check the PHP manual for the differences between the old class model and the new class model.
Comments on this post
PHP beginner agrees!

Reply With Quote
  #8  
Old April 23rd, 2005, 03:44 PM
PHP beginner PHP beginner is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 8 PHP beginner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 6 m 12 sec
Reputation Power: 0
Red face

Thanks, that was the problem, but I run , of couse in a new one. Which says:

ERRNO: 2048
TEXT: var: Deprecated. Please use the public/private/protected modifiers

Had that error the first time ever.
But I go on, trying my very best. Had never something like that at my localhost. What do you think, php wrong verfsion agaon?? But now I am on PHP5. maybe I have to change that folder back to older php version!!

It shows me the error here in my smarty_class.php, the red line

/**#@+
* Smarty Configuration Section
*/
/**
* The name of the directory where templates are located.
*
* @var string
*/
var $template_dir = 'templates';
/**
* The directory where compiled templates are located.
*
* @var string
*/
var $compile_dir = 'templates_c';
/**
* The directory where config files are located.
*
* @var string
*/
var $config_dir = 'configs';
/**
* An array of directories searched for plugins.
*
* @var array
*/
var $plugins_dir = array('plugins');
/**
* If debugging is enabled, a debug console window will display
* when the page loads (make sure your browser allows unrequested
* popup windows)
*
* @var boolean
*/
var $debugging = false;
/**
* When set, smarty does uses this value as error_reporting-level.
*
* @var boolean
*/
var $error_reporting = null;
/**
* This is the path to the debug console template. If not set,
* the default one will be used.
*
* @var string
*/
var $debug_tpl = '';
/**
* This determines if debugging is enable-able from the browser.
* <ul>
* <li>NONE => no debugging control allowed</li>
* <li>URL => enable debugging when SMARTY_DEBUG is found in the URL.</li>
* </ul>
* @link http://www.foo.dom/index.php?SMARTY_DEBUG
* @var string
*/
var $debugging_ctrl = 'NONE';

Reply With Quote
  #9  
Old April 23rd, 2005, 05:07 PM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 1,029 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6
Time spent in forums: 1 Week 12 h 41 m 23 sec
Reputation Power: 15
Send a message via ICQ to Itsacon
Jup, var is a PHP4 keyword, and is deprecated in PHP5 (replaced by the public, protected and private keywords that PHP4 wouldn't take.)

It's a catch-22, you fix it for one version, the other one breaks.

I personally solved it by getting a hosting service that ran PHP5, but another solution would be to write different classfiles, and use the version_compare() function to determine which class to include.

example:
PHP Code:
if(version_compare(PHP_VERSION"5.0.0"))
    include(
'classfile_4.php');
else
    include(
'classfile_5.php'); 

Last edited by Itsacon : April 23rd, 2005 at 05:12 PM.

Reply With Quote
  #10  
Old April 23rd, 2005, 05:24 PM
PHP beginner PHP beginner is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 8 PHP beginner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 6 m 12 sec
Reputation Power: 0
Where do I have to include that version_compare then?? Do I have to include it in the config.inc.php?

My web hosting service tells me I can use in one folder PHP4 and in another PHP5.
I tried that too, but it doesn't work.

Is there anything else I can use for var ??

Sorry for asking so many questions, but I am a kind of beginner in PHP and was so proud that it worked on my localhost and didn't know, that I run in so many problems. Like usual.


Thanks

Reply With Quote
  #11  
Old April 23rd, 2005, 06:22 PM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 1,029 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6
Time spent in forums: 1 Week 12 h 41 m 23 sec
Reputation Power: 15
Send a message via ICQ to Itsacon
If your hosting service supports PHP5, I'd ask tech support how you can enable it, as it without doubt the easiest option.

As for the version_compare(), write all version dependent code twice, (version-dependent => everything with classes :-p) and put it in different include files. Then use the if statement I printed above to decide which file gets included.

But like I said, simply getting PHP5 running is the better option. Send an email to your techsupport.

Reply With Quote
  #12  
Old April 23rd, 2005, 10:59 PM
PHP beginner PHP beginner is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 8 PHP beginner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 6 m 12 sec
Reputation Power: 0
my webhosting server said, that i am already on php5. As you said previously,'var' is only good for php4???
So the solution would be to write all versions code twice. Is there no other way. hell lot of stuff otherwise.

Reply With Quote
  #13  
Old April 24th, 2005, 03:10 AM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 1,029 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6
Time spent in forums: 1 Week 12 h 41 m 23 sec
Reputation Power: 15
Send a message via ICQ to Itsacon
If your hoster says you're on PHP5, I suggest running the following program:

PHP Code:
<?php

echo "PHP VERSION: ".PHP_VERSION;

?>


And see what it says. If it's 5, write PHP5 code, if it's 4, complain to your hoster, as he's lying.

One thing you might try though, is run the same program as above, but with a '.php5' extention, instead of a '.php'. Some hosters differentiate between two installs in that way.

Reply With Quote
  #14  
Old April 24th, 2005, 06:39 PM
PHP beginner PHP beginner is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 8 PHP beginner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 6 m 12 sec
Reputation Power: 0
I did as you said, giving in the code you mentioned. It reallz shows I ama on php5.

It shows> PHP Version 5.0.1

NOw I still get the error:

ERRNO: 2048 TEXT: var: Deprecated. Please use the public/private/protected modifiers LOCATION: /.../libs/smarty/Smarty.class.php, line 75, at April 25, 2005, 12:36 am
Showing backtrace:
require_once("/.../include/setup_smarty.php") # line 3, file: /.../include/setup_smarty.php
require_once("/.../include/setup_smarty.php") # line 9, file: /.../include/app_top.php
require_once("/.../include/app_top.php") # line 3, file: /.../index.php

whats that ??
You told me var is not right for PHP5 but the whole shop is built with php5. What else do you suggest??

Reply With Quote
  #15  
Old April 25th, 2005, 01:30 AM
Itsacon's Avatar
Itsacon Itsacon is offline
Command Line Warrior
Click here for more information
 
Join Date: Aug 2004
Location: Sector ZZ9 Plural Z Alpha
Posts: 1,029 Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)Itsacon User rank is Lance Corporal (50 - 100 Reputation Level)  Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2966446 Folding Title: Super Ultimate Folder - Level 6
Time spent in forums: 1 Week 12 h 41 m 23 sec
Reputation Power: 15
Send a message via ICQ to Itsacon
If you're running PHP5, I would indeed remove all occurences of 'var' and replace them with 'public' or another scope keyword.
This makes me wonder why you ran into problems earlier (which we thought were caused by an older version.)

I'd suggest, rewrite smarty_class.php to PHP5 (again, sorry), and post any errors again, preferably with the full code.

That leaves me with the error in database.php, which shouldn't be there if you're using PHP5. Does it still occur?

Reply With Quote
  #16  
Old April 25th, 2005, 11:03 AM
PHP beginner PHP beginner is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 8 PHP beginner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 6 m 12 sec
Reputation Power: 0
The database.php error is gone, since the server now is on PHP5 and was previously on PHP4.
I try to write smarty-setup.php this eve and hopefully know more by then.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > parse error:T_String


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap