#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    1
    Rep Power
    0

    Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTIO


    [PHPNET="PHP"]PHP[/PHPNET]

    Hello

    When I run this command-bash-3.2 $ php magmi.cli.php-mode = update-profile = default SSH to import a csv file Magento products in my shop I get this message:

    Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/content/17/10622317/html/magmi/inc/magmi_loggers.php on line 4

    <?php
    class FileLogger
    {
    protected $_fname;

    public function __construct($fname=null)
    {
    if($fname==null)
    {
    $fname=Magmi_StateManager::getProgressFile(true);
    }
    $this->_fname=$fname;
    $f=fopen($this->_fname,"w");
    if($f==false)
    {
    throw new Exception("CANNOT WRITE PROGRESS FILE ");
    }
    fclose($f);
    }

    public function log($data,$type)
    {

    $f=fopen($this->_fname,"a");
    if($f==false)
    {
    throw new Exception("CANNOT WRITE PROGRESS FILE ");
    }
    $data=preg_replace ("/(\r|\n|\r\n)/", "<br>", $data);
    fwrite($f,"$type:$data\n");
    fclose($f);
    }

    }

    class EchoLogger
    {
    public function log($data,$type)
    {
    $info=explode(";",$type);
    $type=$info[0];
    echo('<p class="logentry log_'.$type.'">'.$data."</p>");
    }

    }
    class CLILogger
    {
    public function log($data,$type)
    {
    echo("$type:$data\n");
    }
    }
    ?>
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2003
    Posts
    3,854
    Rep Power
    597
    Please edit your post and enclose the code in [ PHP ] tags. See the sticky at the top of this forum that says READ THIS BEFORE POSTING.

    I'm betting the formatter will make your error apparent.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  4. #3
  5. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1015
    Cross-posted at phpfreaks and webdeveloper.com.

    Do you also want us to ask if you actually get the right PHP version? Then you'll claim you've got PHP 5.3, and we'll ask you to prove it etc.

    Three forums working on the same problem without knowing of each other is sooo productive.
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".

IMN logo majestic logo threadwatch logo seochat tools logo