0

I am trying to create a Zend Framework application using the skeleton in NetBeans. When I run Composer install, I get the following error message:

"C:\php\php.exe" "C:\composer\composer.phar" "--ansi" "--no-interaction" "update" "--dev"
You are using the deprecated option "dev". Dev packages are installed by default now.
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - This package requires php >=5.5 but your PHP version (5.4.42) does not satisfy that requirement.
  Problem 2
    - Installation request for zendframework/zendframework 2.5.1 -> satisfiable by zendframework/zendframework[2.5.1].
    - zendframework/zendframework 2.5.1 requires php >=5.5 -> your PHP version (5.4.42) does not satisfy that requirement.

Done.

Apparently, the Zend Framework only needs PHP 5.3+ which contradicts the above. I need to use PHP 5.4.

My composer.json is the following:

{
    "name": "zendframework/skeleton-application",
    "description": "Skeleton Application for ZF2",
    "license": "BSD-3-Clause",
    "keywords": [
        "framework",
        "zf2"
    ],
    "homepage": "http://framework.zend.com/",
    "require": {
        "php": ">=5.5",
        "zendframework/zendframework": "2.5.1"
    }
}

How can I create a PHP 5.4 / ZendFramework 2 application using the skeleton? Is there a workaround? I am new to the ZendFramework and composer.

Jérôme Verstrynge
  • 57,710
  • 92
  • 283
  • 453
  • Face the facts: PHP 5.4 is severely out of date now. All major frameworks move on to only support PHP versions that are actively maintained. This rules out 5.4, which is only getting security fixes for another two months. Symfony moves to >=5.5.9 in their upcoming 3.0 version. Zend switched to >=5.5 in their 2.5.0 release, promising to maintain their 2.4 version (which is announced to be LTS - long term support) for some time (until 2018-03-31). But this really doesn't help anyone if the PHP being used is outdated. The pressure to update PHP is building up. – Sven Jul 06 '15 at 00:09

3 Answers3

1

The page you linked to is out of date. Zend Framework 2.5 requires PHP 5.5 or above. You could run ZF 2.4.x on your PHP version, but PHP 5.4 reaches end of life in a couple of months, so you'd be better off installing a more up to date version of PHP if you can.

Tim Fountain
  • 33,093
  • 5
  • 41
  • 69
0

I quote from the code snippet you put here:

"php": ">=5.5",

Remove that line and everything works fine.


Btw, never have a locked version in your composer.json file. Locked versions are done by Composer automatically in composer.lock when running composer update. Instead, use a version constraint like ^2.5.1 (meaning >=2.5.1,<3.0-dev) or ~2.5.1 (meaning >=2.5.1,<2.6-dev).

Wouter J
  • 41,455
  • 15
  • 107
  • 112
  • The skeleton will require Zendframework in version 2.5.1, and this indeed also requires PHP 5.5. Removing the requirement from the skeleton package will not solve the problem. Updating PHP will solve it. Alternatively, downloading an older version of the skeleton would also do it. – Sven Jul 05 '15 at 23:57
  • I have tried to remove the line you mentioned, but Sven is right, I still have a php version issue... – Jérôme Verstrynge Jul 06 '15 at 08:46
0

A simple and easy solution: Install Bitnami Lamp Stack It has all you need, including a full zendframework.

Once you have Lamp Stack (linux) or Wamp Stack (windows) go to the config directory located at a path like: /home/user/lampstack-5.6.29-1/apache2/conf/bitnami and edit the file bitnami-apps-prefix.conf you will found there a commented line as

#Include "/home/user/lampstack-5.6.29-1/frameworks/zendframework/conf/httpd-prefix.conf"
// uncomment it deleting the character "#"
// let it:
Include "/home/user/lampstack-5.6.29-1/frameworks/zendframework/conf/httpd-prefix.conf"
// save changes and exit.

Restart the server if it is running. Now you have zend, php, apache and mysql running.

greetings