guys I have a shared hosting and I can't use SSH or call shells with php (shell_exec),for security reasons, I can't upgrade my server for money problems...But i need to install Composer, and work with an SDK for finish my project?Is there any way to install/use composer without SSH? I have read about install Composer offline, and then upload the contents on the server, but i don't think that this work...
Thanks for read! Hope that you all'll have a nice day!
As You Said You Want to Install Composer Without SSH then
In that case you Have to install it in your local system than after you can easily upload it using FTPand its Works if your host is supported !!
Steps For Shared Hosting Using FTP::
First Download Php Shell From Here: http://phpshell.sourceforge.net/
In PHPShell's config.php Add User & alias:
php = "php -d suhosin.executor.include.whitelist=phar"
Login to PHPShell & Type: curl -sS https://getcomposer.org/installer | php
After Successfully installed, Just Run Composer: php composer.phar
Related
I am trying to use Slim on OpenShift with a free node. I can run composer update from the SSH sessions without any problem.
The only problem is every time I want to commit files through git I have to go to the console and run composer install again. My question is there is any easy way to workaround this? I tried a BASH script in /project/.openshift/action_hooks/post_deploy but the server is not creating the vendor folder under runtime/repo
I always do it via action hooks:
Inside my project directory I have a script called by /project/.openshift/action_hooks/post_deploy where post_deploy is a bash script.
Here goes what I have been using:
#!/bin/bash
export MY_PHPCOMPOSER=$OPENSHIFT_DATA_DIR/composer.phar
# if composer not exists, download
if [ ! -f $MY_PHPCOMPOSER ]; then
cd $OPENSHIFT_DATA_DIR
echo "Downloading composer..."
php -r "readfile('https://getcomposer.org/installer');" | php
fi
$MY_PHPCOMPOSER -n -q self-update
cd $OPENSHIFT_REPO_DIR
# install
php -dmemory_limit=1G $MY_PHPCOMPOSER install
So post_deploy script will perform every time which you push your repo to openshit. It work like a charm!
Side note
Since not always the OpenShift composer's version is updated it's safe
to download a new composer copy and use it.
Also, don't forget adjusting permissions settings.
Helpful links
Openshift builds
Openshift Default Build Lifecycle
I know that my answer is late but according to the Openshift documentation you can enable composer install after each build by just creating a marker file:
touch .openshift/markers/use_composer
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.
I have these things:
the file http://api.odtu.lu/composer.phar
http://api.odtu.lu/phpinfo.php
ftp access
cPanel
Cron jobs on FreeBSD
PHP, Perl, CGI-BIN, Python, Curl.
How can I install Composer? (My aim is to install Restler)
Edit: I do not have SSH access.
This tutorial worked for me, resolving my issues with /usr/local/bin permission issues and php-cli (which composer requires, and may aliased differently on shared hosting).
First run these commands to download and install composer:
cd ~
mkdir bin
mkdir bin/composer
curl -sS https://getcomposer.org/installer | php
mv composer.phar bin/composer
Determine the location of your php-cli (needed later on):
which php-cli
(If the above fails, use which php)
It should return the path, such as /usr/bin/php-cli, /usr/php/54/usr/bin/php-cli, etc.
edit ~/.bashrc and make sure this line is at the top, adding it if it is not:
[ -z "$PS1" ] && return
and then add this alias to the bottom (using the php-cli path that you determined earlier):
alias composer="/usr/bin/php-cli ~/bin/composer/composer.phar"
Finish with these commands:
source ~/.bashrc
composer --version
It depends on the host, but you probably simply can't (you can't on my shared host on Rackspace Cloud Sites - I asked them).
What you can do is set up an environment on your dev machine that roughly matches your shared host, and do all of your management through the command line locally. Then when everything is set (you've pulled in all the dependencies, updated, managed with git, etc.) you can "push" that to your shared host over (s)FTP.
I have successfully installed Composer (and Laravel) on my shared hosting with only FTP access:
Download and install PHPShell on a shared hosting
In PHPShell's config.php add a user and an alias:
php = "php -d suhosin.executor.include.whitelist=phar"
Log in to PHPShell and type: curl -sS https://getcomposer.org/installer | php
When successfully installed, run Composer: php composer.phar
You can do it that way:
Create a directory where you want to install composer (let's say /home/your_username/composer)
Go to this directory - cd /home/your_username/composer
Then run the following command:
php -r "readfile('https://getcomposer.org/installer');" | php
After that if you want to run composer, you can do it this way (in this caseyou must be in the composer's dir): php composer.phar
As a next step, you can do this:
alias composer="/home/your_username/composer/composer.phar".
And run commands like you do it normally: $ composer install
Hope that helps
I was able to install composer on HostGator's shared hosting. Logged in to SSH with Putty, right after login you should be in your home directory, which is usually /home/username, where username is your username obviously. Then ran the curl command posted by #niutech above. This downloaded the composer to my home directory and it's now accessible and working well.
SIMPLE SOLUTION (tested on Red Hat):
run command: curl -sS https://getcomposer.org/installer | php
to use it: php composer.phar
SYSTEM WIDE SOLLUTION (tested on Red Hat):
run command: mv composer.phar /usr/local/bin/composer
to use it: composer update
now you can call composer from any directory.
Source: http://www.agix.com.au/install-composer-on-centosredhat/
Most of the time you can't - depending on the host. You can contact the support team where your hosting is subscribed to, and if they confirmed that it is really not allowed, you can just set up the composer on your dev machine, and commit and push all dependencies to your live server using Git or whatever you prefer.
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
Is it possible to run composer on a cheap webspace that can't be accessed using ssh, only ftp?
Running system('php composer.phar install'); should work in theory - is that the recommended method?
I think the best way, as suggested in the comments before, is to execute the composer step on a local system that is able to do it, and then upload the result via FTP.
Composer has some (probably optional) software dependencies that most likely will not be available on your webspace. For example it needs the Git and SVN client software in case the project you are about to install references such dependencies.
Another thing is that downloading from Github (or anywhere else) can fail. Or trigger the API limit and ask for a login.
You'd really want to collect all the software and know that it worked instead of hoping it will execute well remotely.
I have successfully installed Composer on my shared hosting using only FTP:
Install PHPShell on a shared hosting
In PHPShell's config.php add a user and an alias:
php = "php -d suhosin.executor.include.whitelist=phar"
Log in to PHPShell and type: curl -sS https://getcomposer.org/installer | php
When successfully installed, run Composer: php composer.phar