Failed installation of zend-escaper with Composer - php

I'm trying to install zend-escaper but I'm getting this error:
This is strange as my PHP version (from phpinfo()) is 5.5.19, the message claims it is 5.3.5(!) which should satisfy the requirement anyway.
My ZF version is 1.12.13
I'm using PHP Storm
Can anyone help please?
Thanks
Tomasz

The PHP version on the command line can be a different executable than the PHP running inside the web server. It also can use a different pho.ini configuration file.
So if Composer states the PHP it is using is 5.3.5, this is correct because Composer is directly asking the PHP it is running on for its version. The problem is when this PHP version on the command line is way older then the PHP version in the web server.
Try to update your command line PHP.
Some more things to say: the version 5.3.5 is lower than the required 5.3.23, because the last number in the version is 5 compared with 23, and 5 is less than 23. So the version you are using is below the minimum requirement for zend escaper - at least in the version 2.5.1 you try to use. Such an old PHP was last supported in the 2.2 framework versions, so you might as well try to depend on ~2.2. However this will simply be a workaround for the old cli version.
One other note: You are in the process of installing a zend framework 2 component - don't expect your installed zend framework 1 to support any fancy stuff on its own. It is possible to mix classes with namespaces and without, and even use zf2 things together with zf1, but zf1 won't offer any automatic functionality to use these.

Related

How to downgrade the php version to 5.6 from 7.0 in a symfony project?

I'm working in a project with Symfony Framework, but i have problems with php 7.0. Can I downgrade the php version or I need rewrite the entire application?
Symfony 3 requires at least PHP 5.5.9, so generally speaking, you can downgrade if you want. Of course you might have other limitations, like additional bundles and libraries you have installed and you might have used PHP 7 features inside your own code.
If you want to downgrade you can run:
composer why-not php:5.6
This will tell you which libraries you installed will not work with PHP 5.6. You might be able to downgrade them, but obviously this is not guaranteed and might require changes to how you use those bundles and libraries. For this you will have to check their upgrade guides and "undo" those changes.
For checking your own code you can use tools like etsy's phan to check for compatibility with a specific target version of php: https://github.com/phan/phan#usage

IS Zend Framework 2 work with PHP version 5.3.2?

Is Zend Framework 2 work with PHP version 5.3.2?. During the skeleton application installation i got following message.Is this just a warning or it will cause any problem in future?
D:\web\Apache24\htdocs\zendsample>composer create-project -n -sdev zendframework
/skeleton-application D:\web\Apache24\htdocs\zendsample
Your version of PHP, 5.3.22, is affected by CVE-2013-6420 and cannot safely perf
orm certificate validation, we strongly suggest you upgrade.
Installing zendframework/skeleton-application (2.4.11)
Make thinks short :
With PHP 5.3 you'll not able to use Traits and new features php 5.4 wich is used in most of vendor plugin and the framework itself.
Usually it's strongly recommanded to upgrade your PHP version.
From this link PHP version maintained PHP 5.3 is no longer maintained since 2014. It's antique. You'll be face to security issues and no evolution of your code will be possible.
To answer your question :
You'll not able to use traits
You'll faceing security issues
You'll not able to improve your code withe best practises (wich evolves permanently)
your views can't use short version for echoing stuff <?='toto'?>
All new features linked above are not supported with your version if it's used in the framework, you'll can't run the framework itself.
I recommend upgrade your version at least at 5.6 or 7 for a good longevity support
EDIT : 5.5 to 5.6 because 5.5 no longer supported.
After getting this message i just upgraded my php to 5.5.

good practise to handle composer, shebang and self-compiled php-versions?

I've started a new project in which I like to used the current version of PHP (5.5.12). I compiled this version myself because the version of my distro is 5.3.
I need propel ORM so I installed it via composer.
Now, the propel-script uses this shebang:
#!/usr/bin/env php
which of course calls the main PHP (5.3) and not my self-compiled one. Unfortunately propel needs PHP >= 5.4 and I cannot execute the script without errors.
So my quick-and-dirty solution is to replace the first line in the propel-script with:
#!/opt/php-5.5.12/bin/php
which works, but is not update-safe. At least I think this could be replaced by doing a composer-update.I still need the 5.3-version for other projects, so using an alias is no solution for me.
It's maybe some petty problem, but is there a finer way to combine 3rd-party-libraries via composer with a self-compiled php executable?
I would encourage you to use vagrant and setup a virtual machine environment where php5.5 is installed. You could setup an Ubuntu 14.04 for example, it contains PHP version 5.5.
Developing on your physical machine is sooo yesterday! ;)

PHP 5.3: how to add PDFlib?

I recently upgraded my Linux server from Apache 2.1 to 2.4 and PHP 5.2 to 5.3. Previously I was using pdf.so from PDFlib fine, but when I tried to install it, as downloaded from here,
http://www.pdflib.com/download/free-software/pdflib-lite-7/
PHP failed to load the module as it was compiled in for PHP 5.3. This install was done using the newest version of PDFlib that I could find, 9.0.2.
Anyone know whether this is possible? I've already got things coded in PHP for PDFlib and prefer not to use another library unless the commands are the same.
UPDATE
Has anyone successfully used PDF Lite with PHP 5.3?
You must compile it. Currently no build is available for PHP 5.3.
On the Download-Site, READ the info:
PDFlib Lite source code must be compiled to generate a usable library. PDFlib GmbH does not offer precompiled (binary) versions of PDFlib Lite.
If you have compile errors, check out the error logs - What say it? Yep, i think you need additional sources for compiling (mostly).

PHP 5.2.x and 5.3.x

What are the differences between PHP 5.2.x and 5.3.x?
Because all extensions are made separately for these.
Thanks a lot.
PHP 5.3 is a newer version with a number of new features (closures, namespaces, etc.). Is is the current stable version for the PHP project. PHP 5.2 is an older version, which is now heading towards the end of its support cycle - now only important security issues are being fixed. If you start a new project, start it with PHP 5.3.
When changes in PHP core are made that change the structure enough that extensions can no longer be compatible - the second digit in the version number is incremented (5.0, 5.1, 5.2, 5.3). The first digit is for very major changes changing the whole language (like between PHP 4 and 5). Between 5.2 and 5.3, you can expect source code compatibility (though some incompatibilities exist) but not binary module compatibility.
You can find an exhaustive list of backwards incompatible changes from 5.2 to 5.3 on PHP.net.
PHP extensions depends on the phpapi version among other things, along with the Zend Module API version and the Zend Extension API version, which as far as I'm aware, changes at each PHP version because of the core changes made to the language. This explains why each PHP version has a new build for each extension.
You can find the answer in PHP official website.
In this page: Migrating from PHP 5.2.x to PHP 5.3.x.

Categories