Upgrading OSX El Capitan to PHP 7 - composer-php

I am attempting to use Composer in my Laravel 5.3/Spark/Homebrew environment on my Mac using El Capitan. The composer script is failing with the following errors:
Problem 1
- This package requires php >=5.6.4 but your PHP version (5.5.30) does not satisfy that requirement.
Problem 2
- laravel/framework v5.3.10 requires php >=5.6.4 -> your PHP version (5.5.30) does not satisfy that requirement.
So in an effort to upgrade my installed version of PHP on my Mac, I ran this command:
curl -s http://php-osx.liip.ch/install.sh | bash -s 7.0
I rebooted and checked the version of php
PHP 5.5.30 (cli) (built: Oct 23 2015 17:21:45)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
➜ ~
Any instructions on how I can upgrade the version of PHP on my Mac?

Turns out I needed to simply edit my $PATH. I am using ~/.zshrc and just needed to add the following:
export PATH=/usr/local/php5/bin:$PATH

Related

Laravel Homestead 12.1.0 still using php 8.0 unable to create Laravel 9 projects

I am trying to build a laravel 9 project through homestead but composer is failing since Laravel 9 requires 8.1.^
I removed my homestead box
vagrant box remove laravel/homestead
then added it again
vagrant box add laravel/homestead
but When i check in CLI,
vagrant#homestead:~$ php -v
PHP 8.0.1 (cli) (built: Jan 13 2021 08:22:35) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.1, Copyright (c) Zend Technologies
with Zend OPcache v8.0.1, Copyright (c), by Zend Technologies
I have homestead 12.1.0
Any advice on how to fix this?
Found the solution. The issue was not with the box but instead with vagrant/homestead since I was running an older version.
I updated my vagrant/homestead on my machine to 13.2.1 and this fixed the problem.

composer install complaining about php 7.2 but i'm running php 7.3

I have a symfony4 project and i'm running composer install but i'm getting the following error:
Problem 1
- ocramius/package-versions 1.5.1 requires php ^7.3.0 -> your PHP version (7.2.23) does not satisfy that requirement.
- ocramius/package-versions 1.5.1 requires php ^7.3.0 -> your PHP version (7.2.23) does not satisfy that requirement.
- Installation request for ocramius/package-versions 1.5.1 -> satisfiable by ocramius/package-versions[1.5.1].
however if i do a php -v
this is what i get:
PHP 7.3.10 (cli) (built: Sep 30 2019 22:02:36) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.10, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.10, Copyright (c) 1999-2018, by Zend Technologies
can someone help me with that?
cheers,
d

How to use the respective php version name prior to composer

I try to install an extension using the composer:
composer require magenest/module-worldpay-and-subscriptions:2.0.0
And get this:
[InvalidArgumentException]
Package magenest/module-worldpay-and-subscriptions at version 2.0.0 has a PHP requirement incompatible with your PHP version (5.4.45)
When I run the php -v command it returns:
PHP 5.4.45 (cli) (built: Nov 28 2017 10:34:31)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v10.0.4, Copyright (c) 2002-2017, by ionCube Ltd.
with Zend OPcache v7.0.5, Copyright (c) 1999-2015, by Zend Technologies
However, I have all PHP version installed on my server so when I run a command I usually specify the PHP version beforehand, e.g. php-7.0 bin/magento
Also, when using fakechroot - it has PHP version set within the context of the domain group itself. e.g when I run this command: /usr/bin/fakechroot /usr/sbin/chroot /microcloud/domains/vampm2 /bin/bash and then php -v I get:
[http]$ /usr/bin/fakechroot /usr/sbin/chroot /microcloud/domains/vampm2 /bin/bash
bash-4.1$ php -v
PHP 7.0.26 (cli) (built: Dec 19 2017 17:26:19) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v10.0.4, Copyright (c) 2002-2017, by ionCube Ltd.
with Zend OPcache v7.0.26, Copyright (c) 1999-2017, by Zend Technologies
bash-4.1$ exit
Can anyone tell me how can I run the composer require without composer to read the default PHP 5.4? Working on Magento ver 2.1.8
How can I run the composer in specified version e.g. like I do with Magento php-7.0 bin/magento?
There are three options:
Run composer with another PHP version, eg. through php-7.0 $(which composer)
Add distinct version requirements to your composer.json through a config key like "platform": { "php": "7.0.12" } (see https://getcomposer.org/doc/06-config.md#platform for more details)
Run composer with the flag --ignore-platform-reqs to ignore platform requirements completely. Then whatever you require is installed, without any check for installed PHP versions or extensions

Can i run php from ssh in jelastic?

when i connect to a nginx node - is there a way to execute php scripts?
I basicly want to run composer, but when calling ./composer.phar it says:
"/usr/bin/env: php: No such file or directory"
I suppose i have to run composer locally and upload the files manually, right?
Yes, you can run PHP via SSH on a Jelastic nginx PHP node.
There's a tutorial at http://kb.layershift.com/jelastic-install-composer describing how to install composer on Apache and nginx PHP nodes on the Jelastic platform. I think it will help with your issue.
EDIT: I tested PHP CLI via SSH on a Jelastic nginx PHP node and confirmed it works fine for all PHP versions:
nginx#nginxphp /var/www $ which php
/usr/bin/php
nginx#nginxphp /var/www $ echo $PATH
/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin
nginx#nginxphp /var/www $ php -v
PHP 5.3.29 (cli) (built: Aug 24 2014 19:41:55)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2014 Zend Technologies
nginx#nginxphp /var/www $ php -v
PHP 5.4.32 (cli) (built: Sep 4 2014 10:33:47)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
nginx#nginxphp /var/www $ php -v
PHP 5.5.16 (cli) (built: Sep 4 2014 10:19:16)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
nginx#nginxphp /var/www $ php -v
PHP 5.6.0 (cli) (built: Sep 4 2014 11:18:01)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies
The above is whilst switching the PHP version via the Jelastic dashboard, and is taken using the latest Jelastic version (2.5). If you don't have the same behaviour, I think you should contact your hosting provider for clarification because it should work fine.
Composer install completes ok for me just like this:
nginx#nginxphp ~ $ curl -sS https://getcomposer.org/installer | php
#!/usr/bin/env php
All settings correct for using Composer
Downloading...
Composer successfully installed to: /var/lib/nginx/composer.phar
Use it: php composer.phar

PHP Fatal error: PHP Startup: apc_mmap: mmap failed: in Unknown on line 0

I am trying to get APC up and running for PHP (magento) but i have this weird problem which is bothering me. I have done my apc installation through the below command
pecl install apc
pecl/apc is already installed and is the same as the released version 3.1.13
and i have also added the configuration parameter in /etc/php.d/apc.ini as shown below
extension=apc.so
apc.enabled=1
apc.num_files_hint=10000
apc.user_entries_hint=10000
apc.max_file_size=100M
apc.stat=0
apc.optimization=0
apc.shm_segments=1
apc.enable_cli=1
apc.cache_by_default=1
apc.include_once_override=1
apc.shm_size=4
apc.mmap_file_mask = /tmp/apc.XXXXXX
Before i thought that maybe my configuration is messing up but when i removed every line in the apc.ini file but still i am getting the below error when executing php --ini
PHP Fatal error: PHP Startup: apc_mmap: mmap failed: in Unknown on line 0
Segmentation fault (core dumped)
Now i am really not sure what to do
My PHP version is 5.4
I have resolved this issue after experimenting with the different packages of APC. The tutorial which is out there can be quite confusing because every tutorial mentioning to install the APC with pecl might not work with PHP54.
So what you really need to do is get the correct package for the installation, in my case i issued the below command
yum install php54w-pecl-apc
Once i did that everything went smoothly. The apc.ini file was automatically got created with the basic configuration in location /etc/php.d
phpinfo had also listed the APC as configured.
My php version
php -v
PHP 5.4.11 (cli) (built: Jan 30 2013 18:05:25)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

Resources