I have a problem. I'm trying to deploy my zend framework app on a shared hosting. In local, with xampp was everything ok, but on shared hosting I received the following message: Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /application/public/index.php on line 40. The line 40 is: $application->bootstrap()->run();. Any idea?
The T_OBJECT_OPERATOR
token refers to ->
. See the List of Parser Tokens in the PHP Manual. What is the PHP version of the shared host? If it is still running PHP4, you wont be able to run ZF on it (and you should change hosting asap). If it is running PHP5, make sure it is PHP 5.2.4 (or higher) and please tell us which version of ZF you are using.
EDIT 2
The errors are usually logged to the server log. Since you are on a shared host you might not be able to look into it though. What you could do is find the hidden .htaccess file in your document root, e.g. the public folder of ZF and uncomment the directives inside line by line. If the error goes away, then you will likely know what is wrong. Could be mod_rewrite
. You could also try to use apache_get_modules to find out which modules are enabled. But then again, are you sure it is an Apache?
EDIT 3 Not sure about how to get it working without mod_rewrite. Maybe this rather lenghty tutorial by Rob Allen will help to get it working. A much shorter option could be to simply set
$frontController->setBaseUrl('/path/to/app/index.php')
as was suggested in the ZF Forum
It's possibly due to different versions of PHP. Maybe your shared host is running an old version. On most systems, you can get the php version, by creating a page with this content:
<?php
phpinfo();
?>
It's possible that your shared host will not allow the phpinfo function. I'd suggest first comparing the versions of PHP your running, and possibly updating your question.
The error 500 could be caused by an error in your .htaccess file. Is mod_rewrite enabled?