By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,722 Members | 1,904 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,722 IT Pros & Developers. It's quick & easy.

Error accessing class files in php

P: n/a
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

Apr 29 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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.

--
Ra*********@gmail.com

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

P: n/a
On Apr 29, 12:12 pm, Rami Elomaa <rami.elo...@gmail.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...@gmail.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

Apr 29 '07 #3

P: n/a
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
http://tobyinkster.co.uk/
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
Apr 30 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.