Jump to content

Code worked ok on local server but not on web host


magicmoose

Recommended Posts

Hi,

I'm having some problems with some code I've just tried to upload. 

At the beginning of the code, I include a bunch of classes, each of which start with declerations, eg

 

public $something
private $something
protected $something 

 

etc

 

Everything works fine on my local machine, but when I upload it, I get errors like:

Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /usr/local/psa/home/vhosts/mysite.com/httpdocs/test/classes/page.php on line 4

 

If I change the public/protected/private etc to var, the errors stop, but surely this isn't good practice.  Can anyone tell me what's going on?

 

Thanks.

 

Your web host is still running php4. You are trying to use php5 syntax. You need to switch your hosting to php5. You can usually do this through your control  panel, a change in a .htaccess file, or by changing file extensions (check with your web host exactly how to do it on their servers.) The end of life of php4 was more than one and a half years ago, there is no excuse for any host or programmer to still be using php4.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.