Reputation: 2476
I have made an application that uses ZF2 and deployed it on a server that is running php 5.1. The application works fine through a web interface but when I try to use the CLI to run an action I get the following error:
[user@domain public]# php index.php generate
PHP Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /var/www/website/public/index.php on line 17
PHP Parse error: syntax error, unexpected T_STRING in /var/www/website/public/index.php on line 17
The cli functionality will be for some basic cleaning and maintenance jobs via cron. The line that is causing the issue in index.php
is:
Zend\Mvc\Application::init(require 'config/application.config.php')->run();
So it's obviously the way the class is getting called with '\'. Is there a way to fix this and why does the normal website run if supposedly php 5.1 isn't supported with ZF2.
Thanks in advance.
Note: Please try give an answer that doesn't ask me to upgrade php 5.1. Thanks :)
Upvotes: 1
Views: 652
Reputation: 814
I'm sorry, there is no other answer.
Zend Framework 2 uses a lot of PHP 5.3 features, such as namespaces, which is what is bugging your application right now.
If you can't upgrade your PHP version, you can't use Zend Framework 2.
The fact that your web interface is working fine is very interesting altought. I bet if you phpinfo()
that server you'll find another PHP version.
Nevertheless, you really should think about upgrading your PHP version. There's a ton of new/improved features, performance enhacements (such as OPCache), etc. Also, as it's deprecated, you won't get any security updates (which btw PHP 5.1 has many of them).
Upvotes: 1