Error accessing class files in php

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hello php group,

I have a dev server running php 5.0 and apache 2.2, I have created
some php files that create classes, etc  All works well with this.

But when I copy the files to my hosting service's server - I get the
following error :
Parse error: parse error, unexpected T_CLASS in /home/3/2/2/3468/3468/
usr/include/classes/Portfolio.php on line 2.

I have a file called common.php which references the classes I have
a snippet of code is:

    require_once '/home/3/2/2/3468/3468/usr/include/classes/
    require_once '/home/3/2/2/3468/3468/usr/include/classes/


The error occurs at the first line in the class definition: it gives
me the error where I have the word "abstract"
abstract class Portfolio
  public static $db;
  public static $queries;
.... other functions, methods, etc

} //end of class def.

I also get the same type of error (moving the PortfolioImages.php file
to the first position in common.php)

18 March 2007 - Modified to use the portfolio table ,for insert of
portfolio image data
10 April 2007 - Copied the PortfolioImage.php class to a class for the
portfolio table

class PortfolioImage
  public $id;
  public $folio;        //same as "p"
  public $pfolder;      //same as folder
  public $pname;
  public $_tn_width;
  public $_tn_height;
  public $oheight;
  public $owidth;

.... other functions, methods, etc

} //end of class def.

The above code gives the same parse error but as soon as it sees the
first variable definition, public $id, but on a different line number

I see where PHP 4.3 should support OOP type coding, etc.  Is there
something that my hosting service needs to do???  or something I need
to do???

I have considerable time developing the code, and would hate to have
to re-write for my hosting server!!  Any ideas on this??



Re: Error accessing class files in php

eholz1 kirjoitti:
Quoted text here. Click to load it

abstract was introduced in php 5. You can't get this code working on php  
4 server without modifications. Contact your current host and ask if  
they're offering php 5. If not, find another host. That is, unless you  
want to rewrite the code to php 4 compatible.

FYI: OOP support in older php versions sucked until php 5.


"Wikipedia on vähän niinq internetin raamattu, kukaan ei pohjimmiltaan
usko siihen ja kukaan ei tiedä mikä pitää paikkansa." -- z00ze

Re: Error accessing class files in php

Quoted text here. Click to load it

Hello all,

Hmmm,  a good point!  also I am using mysqli (for stored procedures).
I am in trouble now!

Re: Error accessing class files in php

eholz1 wrote:

Quoted text here. Click to load it

I would agree with Rami that the best solution is to upgrade your hosting
rather than downgrade your code!

Toby A Inkster BSc (Hons) ARCS
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!

Site Timeline