views:

190

answers:

3

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?

A: 

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

Gordon
Thanks for your answer. You're right! the problem was the php version of the shared host. Now I'm running it with PHP5 (5.2.10), the version of ZF i'm using is 1.9.4. I have now another problem. The template is loaded correctly but i receive an application error: error 500. Any idea? Thanks a lot!
see edit 2 please
Gordon
You're right Gordon! The hosting haven't the mod_rewrite. Now the problem is: how could I use ZF without mod_rewrite? :(
Hi Stefano, see edit 3 please
Gordon
A: 

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.

brianegge
A: 

The error 500 could be caused by an error in your .htaccess file. Is mod_rewrite enabled?

Ekerete
Thanks for your reply. how can i check if mod_rewrite is enabled? i tried with phpinfo(); but there aren't any info on apache configuration ... thanks a lot!