Install Composer without curl (local) - php

I have to run a Laravel Project on a customers Server, Mcrypt is already installed but I can't run "composer install" because composer is missing. Problem here is, that I can't run
curl -sS https://getcomposer.org/installer | php
because I don't get a connection to other server "outside".
So does anybody know, if I can save the file local and upload it with FTP and run it?
Already tried to save the /installer as a file and run it with "asdf | php" but it didn't work. I also downloaded the composer.phar file but how do I run the .phar file?
Thanks!!

Downloading the composer phar file as you have done is a sufficient alternative.
Usage:
php composer.phar command
Docs: https://getcomposer.org/doc/01-basic-usage.md
However, I am fairly sure composer depends on curl, at least as far as updating/installing packages goes. So if you're intending to use those features you'll need curl anyway.*
*citation needed.
edit:
I am currently looking through the composer source and I can't yet find a reference to curl. It appears to use stream_context_create, and the manual page for that method doesn't mention curl either. So maybe it'll work without curl...

Related

How to upgrade to PHP 7.0 on macOS Sierra?

I tried to update my PHP version on my mac but I am facing some issues
When i use cURL it freezes and it will never complete the download on the terminal:
This is the cURL command that I am running is: curl -s https://php-osx.liip.ch/install.sh | bash -s 7.2
I tried to download a package manually but I can't extract it or even know how to install it.
You can use home-brew for installation / https://medium.com/#romaninsh/install-php-7-2-on-macos-high-sierra-with-homebrew-bdc4d1b04ea6 , I find it quite better then managing with Mac OS build in PHP
I don't have enough details so I will go in blind guess here.
First judging by screenshot it is stuck on downloading. For how long it was frozen? Maybe you didn't wait enough.
When you downloading the source what you need to do is:
Assuming you downloaded package with name php-7.2.6.tar.gz from PHP Official website.
Execute command tar xzf php-7.2.6.tar.gz from command line. (assuming you are in the same directory as file). It will unpack it in directory called php-7.2.6.
Enter the directory with command cd php-7.2.6.
Enter in terminal ./configure. It will take a while, so make sure to get some coffee.
After ./configure finished, execute command make. This will take a while as well, so you might get a sandwich.
Once command finished executing the last step will be executing command make install. It will be quicker than others, don't worry. After that you will be able to execute php command.
Optional Run make test to make sure everything is fine.
PHP has been installed, HOORAY!
Hope that helped, have a nice day. And if I answered your question, please mark it 'Answered`.

Can I use composer without installing it?

I've noticed on a lot of open source user systems, like UserFrosting or Drupal they some how use composer, without the user actually having to install composer on to there server. I was just wondering how would I be able to do this, I've had a look around and can't find anyway of just using the files.
Thank you.
Yes, you could simply download the composer.phar file, and run it from CLI like:
cd ~/
wget https://getcomposer.org/composer.phar
php composer.phar [command]
You'll need at least PHP v5.6.x and the mcrypt extension installed for the CLI SAPI.

How do I install Composer without cURL command line?

I need to install Composer on a shared hosting service. This service supports cURL, but does not support SSH access. As a result, I cannot run cURL commands from the command line.
Is it possible to install cURL without a command line? Perhaps a PHP script that I run only once?
Install the composer.phar file locally and then just upload it to your hosting provider.
Alternatively, you can download composer.phar from their website.
However, it's unlikely that you'll be able to run it. Unless you are using it programatically, I recommend you install all of your dependencies locally into a release branch/package and upload that to your hosting provider.
The download page of the composer site has instructions for those missing curl that only require php:
php -r "readfile('https://getcomposer.org/installer');" | php
The above is the recommended way, but alternatively if you don't want to run the installer and all the config checks it does, you can just download the phar file from https://getcomposer.org/composer.phar - either using your browser or via wget https://getcomposer.org/composer.phar (if you have access to wget).
Get the file from https://getcomposer.org/composer.phar
And then use with php prefix of every commands.
Example of a batch on windows OS:
C:\xampp\php\php composer.phar create-project laravel/laravel C:\xampp\htdocs\laravel42 4.2 --prefer-dist
You can also create a simple batch file to do it globally:
:: File Name should composer.bat
#ECHO OFF
SET PATH=%PATH%;%~dp0
setlocal DISABLEDELAYEDEXPANSION
SET COMPOSER_PROCESS_TIMEOUT=5000
C:\xampp\php\php "%~dp0composer.phar" %*
Now you are able to use it VIA evnironment setup or directly to this batch file.

having problems with the shopify php api when looking for the shopify_api

PHP API using: https://github.com/sandeepshetty/shopify_api
I have PHP 5.3.27 installed
I installed Composer (by going to
the website and using their install.exe)
It mentions that
"This will download shopify_api into the
vendor/sandeepshetty/shopify_api directory."
But I do not see the folders or files anywhere on the computer.
The plugin author is saying that if you download Composer with the instructions he provided (via Terminal), then Composer will autoload those files for you. Unfortunately, though easier, simply going to the source URL for the Composer tool won't do that for you.
First, make sure you have created the composer.json file and stored it in your project directory. Then, log into your server or system via the command line (Terminal for Mac OS, Putty for Windows). Cd into your project directory, and install by entering these commands:
$ curl -s http://getcomposer.org/installer | php
$ php composer.phar install

Php update (Package 5.5-frontenddev is already installed)?

I am trying to update my Php to 5.5 on a mac (by pasting "curl -s http://php-osx.liip.ch/install.sh | bash -s 5.5" into terminal). The download starts but gives the following message before the downloads stops:
Package 5.5-frontenddev is already installed at version 5.5.5-20131020-233829. You wanted to install version 5.5.5-20131020-233829.
Is there anyway around this as I really need 5.5 in order to continue with my course!
Thank you in advance for any help.
Margate
You should be able to delete the packager registry log and just try the command again, making sure you have removed the relevant folders from /usr/local/php5-*.
The file is located at:
/usr/local/packager/registry.log

Categories