Error accessing class files in php

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • eholz1

    Error accessing class files in php

    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
    made.
    a snippet of code is:
    <?php

    require_once '/home/3/2/2/3468/3468/usr/include/classes/
    Portfolio.php';
    require_once '/home/3/2/2/3468/3468/usr/include/classes/
    PortfolioImage. php';

    ?>

    The error occurs at the first line in the class definition: it gives
    me the error where I have the word "abstract"
    <?php
    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)

    snippet:
    <?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
    (9).

    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??

    thanks,

    eholz1

  • Rami Elomaa

    #2
    Re: Error accessing class files in php

    eholz1 kirjoitti:
    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
    >
    The error occurs at the first line in the class definition: it gives
    me the error where I have the word "abstract"
    <?php
    abstract class Portfolio
    {
    public static $db;
    public static $queries;
    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.

    --
    Rami.Elomaa@gma il.com

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

    Comment

    • eholz1

      #3
      Re: Error accessing class files in php

      On Apr 29, 12:12 pm, Rami Elomaa <rami.elo...@gm ail.comwrote:
      eholz1 kirjoitti:
      >
      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
      >
      The error occurs at the first line in the class definition: it gives
      me the error where I have the word "abstract"
      <?php
      abstract class Portfolio
      {
      public static $db;
      public static $queries;
      >
      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.
      >
      --
      Rami.Elo...@gma il.com
      >
      "Wikipedia on vähän niinq internetin raamattu, kukaan ei pohjimmiltaan
      usko siihen ja kukaan ei tiedä mikä pitää paikkansa." -- z00ze
      Hello all,

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

      Comment

      • Toby A Inkster

        #4
        Re: Error accessing class files in php

        eholz1 wrote:
        Hmmm, a good point! also I am using mysqli (for stored procedures).
        I am in trouble now!
        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
        Fast withdrawal casino UK 2025 – Play now & cash out instantly! Discover the top sites for rapid, secure payouts with no delays.

        Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

        * = I'm getting there!

        Comment

        Working...