Jump to content


Photo

Parse error: parse error, unexpected T_CONST???


  • Please log in to reply
8 replies to this topic

#1 cjbeck71081

cjbeck71081
  • Members
  • PipPipPip
  • Advanced Member
  • 70 posts

Posted 21 September 2006 - 07:08 PM

Parse error: parse error, unexpected T_CONST, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in C:\www\mapviewerphp\constants.php on line 29


see if anyone knows what its looking for, here is the code.

<?
class MgMimeType
{

/// LINE29   const Agf  = "application/agf"; /// \if INTERNAL  \endif 
   /// application/octet-stream
   const Binary  = "application/octet-stream"; /// \if INTERNAL  \endif 
   /// model/vnd.dwf
   const Dwf  = "model/vnd.dwf"; /// \if INTERNAL  \endif 
   /// image/gif
   const Gif  = "image/gif"; /// \if INTERNAL  \endif 
   /// image/jpeg
   const Jpeg  = "image/jpeg"; /// \if INTERNAL  \endif 
   /// image/png
   const Png  = "image/png"; /// \if INTERNAL  \endif 
   /// text/plain
   const Text  = "text/plain"; /// \if INTERNAL  \endif 
   /// image/tiff
   const Tiff  = "image/tiff"; /// \if INTERNAL  \endif 
   /// text/xml
   const Xml  = "text/xml"; /// \if INTERNAL  \endif 
   /// text/html
   const Html  = "text/html"; /// \if INTERNAL  \endif 
   
}
?>

Thanks!

#2 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 21 September 2006 - 07:08 PM

Works fine for me. Is that the only code you got?

#3 cjbeck71081

cjbeck71081
  • Members
  • PipPipPip
  • Advanced Member
  • 70 posts

Posted 21 September 2006 - 07:25 PM

Yea, im afraid my PHP might not be installed correctly, do you know what file that referances, so i can check to see if it exists?

#4 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 21 September 2006 - 07:28 PM

Ahhh... you must be using PHP4... const is for PHP5 only.

#5 cjbeck71081

cjbeck71081
  • Members
  • PipPipPip
  • Advanced Member
  • 70 posts

Posted 21 September 2006 - 07:29 PM

Nope im Version 5.1

www.cbeckserver.com/phpviewersample/testing.php

thats my PHP info page

i dont know what PHP application page, wants that information, but im afraid i might not have it.. In other words my PHP is working, but barely...

Thanks

#6 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 21 September 2006 - 07:30 PM

"PHP Version 4.3.2" at the very top ;)

#7 cjbeck71081

cjbeck71081
  • Members
  • PipPipPip
  • Advanced Member
  • 70 posts

Posted 21 September 2006 - 07:30 PM

Just as i looked at that, i noticed that i was reading the 5.1 build... not the version number, i am using 4.3.2 i guess, what is your recommendation?

#8 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 21 September 2006 - 07:48 PM

Just as i looked at that, i noticed that i was reading the 5.1 build... not the version number, i am using 4.3.2 i guess, what is your recommendation?


well, seeing that PHP 4 is finicky when it comes to OOP in some cases, really your best bet is to simply come up with a naming convention for your const vars and define them within your constructor:
<?php
class MgMimeType { 
  var $BINARY;
  var $DWF;
  var $GIF;
  var $JPEG;

  // then, initiate values for them within your constructor
  function MgMimeType() {
    $this->BINARY = "application/octet-stream";
    $this->DWF = "model/vnd.dwf";
    $this->GIF = "image/gif";
    $this->JPEG = "image/jpeg";
  }
}
?>

hope this helps
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#9 cjbeck71081

cjbeck71081
  • Members
  • PipPipPip
  • Advanced Member
  • 70 posts

Posted 21 September 2006 - 07:58 PM

I actually started to install PHP5.1 a few minutes ago.  I figured it was the easiest way to fix the problem... Turns out i get a new error.


Security Alert! The PHP CGI cannot be accessed directly.
This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that a page will only be served up if the REDIRECT_STATUS CGI variable is set, e.g. via an Apache Action directive.

For more information as to why this behaviour exists, see the manual page for CGI security.

For more information about changing this behaviour or re-enabling this webserver, consult the installation file that came with this distribution, or visit the manual page.


I think its a setting in the PHP.ini file, have u ever seen this before?






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users