view raw
Yossi Yossi - 9 months ago 51
PHP Question

Setting up Zend Framework 2

I setup ZF2 on a shared server. It works perfectly on the localhost, though on the shared server I get this error:

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/content/82/5123082/html/tmp/ZendSkeletonApplication/public/index.php on line 12

Parse error: syntax error, unexpected T_STRING in /home/content/82/5123082/html/tmp/ZendSkeletonApplication/public/index.php on line 12

On line 12 of the index.php code:

Zend\Mvc\Application::init(include 'config/application.config.php')->run()->send();

The PHP version the account is running:
PHP 5.3.13 (cli) (built: May 14 2012 16:26

The Linux server that is used is:
Linux ... #1 SMP Fri Jul 15 08:15:44 EDT 2011 i686 i686 i386 GNU/Linux
CentOS release 5.5 (Final)

I'm not using doctorine - it doesn't even load the Skeleton application right now - as if there's a problem with the namespace, and it doesn't load it. It's as if the PHP version run is not PHP 5.3.

Any ideas what am I doing wrong? I tried installing it through the composer and upload a working solution from my local machine, neither worked..


Apparently, the server was running PHP 5.3 in the SSH console, however the Apache server was still using PHP 5.2, therefor unable to use namespaces.

So, even though the account was setup for "PHP 5.3", the .htaccess needs to be changed in order to support that.

In order to fix the problem, add the following line to the .htaccess file in the /public/ folder:

AddHandler x-httpd-php5-3 .php