2

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?

fabs
  • 77
  • 1
  • 1
  • 13

1 Answers1

3

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

Damien - Layershift
  • 1,508
  • 8
  • 15
  • Hello Damien, thank you for your answer. I have already read this tutorial. When i log in to a PHP node (with nginx) i get the following result: `code nginx@nginxphp ~ $ curl -sS https://getcomposer.org/installer | php -bash: php: command not found curl: (23) Failed writing body (0 != 8030) ` Is this feature only available with a certain jelastic version? – fabs Oct 25 '14 at 10:45
  • I tested the tutorial with a new Apache instance, and its working. Seems that you cant run php scripts on Nginx instances. – fabs Oct 25 '14 at 11:03
  • @fabs check my edit. if you don't get the same behaviour please contact your hosting provider's support team for assistance. – Damien - Layershift Oct 27 '14 at 10:07
  • Thank you very much for your answer. It seems there has been a bug with my old environment which i created a while ago. After switching the PHP version everything is working as expected and i can now use composer via ssh. Again, thank you very much. – fabs Oct 27 '14 at 20:01
  • @fabs that's great to hear! thanks for following up to share your success story. – Damien - Layershift Oct 28 '14 at 13:28