Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I wrote a php script that use simple_html_dom to parse a website infos. Its a big script and when I try to run it on my browser the script works but Time out before to end.. When I try using SSH I get this error:

Parse error: syntax error, unexpected T_OBJECT_OPERATOR in .... on line 30

line 30:

$titlevar = explode('for €', $element->find('a[class="title-link"]', 0)->plaintext);

Whats wrong with my code ? PS: I thought it was a problem with my php version so I tried to rename my file to .php5 but still not working... I changed my .htaccess to enable php5 but still when I use php -v it shows me PHP 4.4.9.

EDIT:

I had to run my script with this:

php5.4 script.php

share|improve this question
2  
Why are you still using an ancient PHP version? PHP 4.4.9 was released almost 5 years ago. You should upgrade your PHP version. –  Amal Murali 1 hour ago
 
On my hosting settings PHP is set to 5 but whith SSH it shows me 4.4.9 –  user3125921 1 hour ago
1  
Then ask your hosting provider to upgrade the CLI version of PHP to match the Webserver version –  Mark Baker 32 mins ago
add comment

1 Answer

If you're unable to access CLI php with a modern version, you can execute the script through the webserver by using something like wget to run it through the webserver. Might want to set it up to run through localhost in that case.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.