Is it possible to check for the specific features required for drush (e.g., JSON), rather than checking the PHP version number? The 2.0 release of Drush does an explicit check for PHP version number, and exits if it is below 5.2. I used prerelease versions of drush 2.0 very happily on my RHEL servers running PHP 5.1.6. To make it work, I had to explicitly install and activate JSON.

Unfortunately it is not an option for RHEL users to upgrade PHP, as RedHat does not offer a 5.2.x version of PHP (and the reason people pay RedHat so much money is for the support - which is invalidated if you install non-RedHat versions of packages).

If the 5.2 requirement is for JSON only, it would be better to check for JSON support rather than checking just the PHP version number.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jeffschuler’s picture

+1 for this.

While I appreciate Moshe's point in #479718: Undocumented dependency on php version >= 5.2.4, I'm on the same page, here, having a number of CentOS/RHEL servers that must stick to supported PHP releases...

Owen Barton’s picture

The previous issue was kind of deconstructed by some unhelpful and unfriendly name calling, but I think it is fair to say that a patch that reliably checks for the specific functionality in the appropriate place in the bootstrap or command, or finds a way to gracefully degrade if possible (as we did in the previous patch) it will certainly be looked at.

tedp’s picture

I hope this patch is created. I want to install Drush 2.0 but am stuck with Red Hat support for PHP 5.1.6 since I'm paying for RHEL 5. I'm on Drupal 5.x and am not expecting to upgrade to Drupal 7.x anytime soon, with its dependency on PHP 5.2.

--Ted

seanr’s picture

Title: Drush requires PHP 5.2. The most recent version of PHP available from RedHat is 5.1.6 » Check for JSON functions rather than PHP 5.2
Status: Active » Needs review
FileSize
932 bytes

The attached patch replaces the version check with tests for the functions json_decode and json_encode. Tested on my PHP 5.1.6 server with and without json enabled and all appears to function as expected.

moshe weitzman’s picture

I suspect that we are relying on 5.2 in more places than just JSON. Needs thorough testing.

seanr’s picture

Has anyone other than me been able to test this? I've been using it successfully on my server and have not run into any problems, but if we can get some more people testing it, we'd have a better shot at finding and working around any other dependencies.

seanburlington’s picture

FileSize
33.22 KB
2.53 KB

The patch above applies cleanly and appears to work

However I'm not even in a position to install pecl packages on this server so it doesn't get me very far.

Ironically my site *is already* using JSON - but via a class!

So I've taken the same approach to adapting drush to remove the JSON dependency entirely.

The patch adapts Drush to use the JSON class (also attached) from http://pear.php.net/pepr/pepr-proposal-show.php?id=198

For users who want Drush on RedHat but can't go outside packages or compile stuff this may be a solution

This patch runs cron and update for me but is otherwise untested.

seanburlington’s picture

Title: Check for JSON functions rather than PHP 5.2 » Make Drush support PHP 5.1

I'm suggesting a slight change of goal here

I think that Drush should work wherever Drupal works.

@Moshe - I agree this needs more testing

moshe weitzman’s picture

Status: Needs review » Needs work

no progress. 5.1 is even more ancient than when we started this. i don't see this happenning.

seanburlington’s picture

Status: Needs work » Needs review

Hi Moshe,
I understand that PHP 5.1 is old - but it's still the only supported version on RedHat

If you think the patch needs work - can you clarify what work?

Have you found a problem with it?

It works for me

I think it's more useful to leave this issue flagged as needs review to encourage others who need it to try out the patch and report back if it works for them.

moshe weitzman’s picture

Status: Needs review » Needs work

my problem with the patches is that they only deal with json_encode. but this change implies that we cannot take advantage of other 5.2 features, at least in core drush. and drush plugins tend to follow what drush does so they are affected too.

we already have a tremendous backwards compat burden supporting 3 major versions of drupal. adding backward compat for old php versions is too much for me. php 5.2 was released on 02-Nov-2006.

i'm aware of the redhat problem. 3 years is apparently not enough for them to get onto latest php. thats not our problem.

seanburlington’s picture

Title: Make Drush support PHP 5.1 » Release a version of Drush that supports PHP 5.1
Status: Needs work » Needs review

Hi Moshe,
like with IE6 - old versions are our problem - we as developers can't always just say "upgrade" - and be done with it :-)

I can see that you don't want to be held back forever - so how about this...

Why not release a version of Drush that works on PHP 5.1 - maybe using my patches - this branch wouldn't see new development but making it available would still be pretty useful.

As far as I can see all this would need is the creation of a branch and the application of the existing patch.

What do you think?

moshe weitzman’s picture

I'm still not interested. If one of the other maintainers wants to look after this branch, then thats OK.

seanburlington’s picture

Hi Moshe
maybe you want to mark this as won't fix ?

I can't see how any level of work or review is going to change anything - so asking for more work or more review seems fairly pointless.

At least a won't fix decision is clear

and then people can make their own decision if they want to use the patch :-)

greg.1.anderson’s picture

When drush-3.0 stable lands, anarcat is going to continue to maintain the 3.0 branch, while drush-HEAD moves on toward 3.1 and 4.0. It therefore would make sense, I think, for anarcat to decide whether or not to support older versions of php in the maintenance branch.

Anarcat is not yet a maintainer, though, so I cannot assign this issue to him.

moshe weitzman’s picture

Status: Needs review » Closed (won't fix)