Can i run php from ssh in jelastic? - 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

Related

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

Different version of Php 7.x

I have different version of Php on my laravel homestead. If i lunch php -v on command bash i have active php 7.3 but if i create and index.php with phpinfo() i have this 'PHP Version 7.2.14-1+ubuntu18.04.1+deb.sury.org+1'
php -v
HP 7.3.1-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Jan 13 2019
10:19:33) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine
v3.3.1, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.1-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
with Xdebug v2.7.0beta1, Copyright (c) 2002-2018, by Derick Rethans
with blackfire v1.24.2~linux-x64-non_zts73, https://blackfire.io, by Blackfire
in my index.php
phpinfo();
i have
PHP Version 7.2.14-1+ubuntu18.04.1+deb.sury.org+1
I want to use only php 7.3 how can i do it please?
For ubuntu users this should work (with apache)
sudo a2dismod php7.X
sudo a2enmod php7.3
sudo service apache2 restart
Witn nginx in your .conf change the version for fastcgi
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
service nginx restart

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

Composer and ext-xdebug? Can't install anything

Whatever I do in composer, I get this message
[InvalidArgumentException]
Package is not installed: ext-xdebug-2.4.1.0
I have tried actually installing that package and get the same error.
Any suggestions?
Running Arch Linux with composer as global.
EDIT: as you can see, I have xdebug installed and enabled.
╭[andrew#TheSandbox] : [~]
╰>php -v
PHP 7.0.14 (cli) (built: Dec 7 2016 17:11:27) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Xdebug v2.4.1, Copyright (c) 2002-2016, by Derick Rethans
╭[andrew#TheSandbox] : [~]
╰>php -m
[PHP Modules]
...
xdebug
...
[Zend Modules]
Xdebug

Upgrading OSX El Capitan to PHP 7

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

Resources