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.

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.