I am installing the Laravel framework in directory /var/html/www, using command
php composer.phar global require "laravel/installer"
It changes installation directory automatically, shown message is:
Changed current directory to /home/.composer
What is the reason? Do I need to add any other command?
This is because you installed the Laravel installer with global, which makes it globally available for all projects and installs it to /home/.composer.
This should be all right because it is only Laravel's installer and not a Laravel project which should be created in a later step (see below) and this should be installed in your /var/html/www then.
Run the following command in your /var/html/www to create a new project (doesn't need Laravel installer):
composer create-project --prefer-dist laravel/laravel YourProjectName 5.2
or use the Laravel installer
laravel new YourProjectName
For more info how to install Laravel see the documentation here.
Let use
composer create-project --prefer-dist laravel/laravel project_name "5.2.*"
1) change the permission of your directory to allow CRUD.
Open Terminal and paste this command
sudo chmod -R o+rw /var/html/www
2) update the package manager cache by running:
sudo apt-get update
3) cd to your directory to check if composer json does exist
cd /var/html/www
and type
composer
4) To install composer in your directory run
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
5) To test if it's installed run
composer
6) Now install laravel 5.2 in your directory (/var/html/www)
composer create-project laravel/laravel ProjectName 5.2 --prefer-dist
Related
I would like to know how to install composer with the vendor/bin folder to be able to run the laravel new project as describe in the laravel docs and not only install the composer binary for install and update packages.
I think you are looking for this command :
install composer in /usr/bin
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php --filename=composer --install-dir=/usr/bin
install Laravel installer
composer global require laravel/installer
Make sure your Env path variable have :
$HOME/.config/composer/vendor/bin
I am installing Laravel 5.6 with the composer. This process is carried out in Windows 10's native command prompt. However when I type in composer create-project --prefer-dist laravel/laravel my_blog, composer doesn't do anything. It just stays still. Left it for 1.5 hours and the result is same.
Please help me fix it.
php composer create-project laravel/laravel my_blog --prefer-dist
File composer.phar must be in folder where you start command create-project OR add composer.phar to your PATH environment variable
For test (in terminal):
composer -V
I've been trying to install laravel on Ubuntu 14.04. I finished all the steps, but when try to
laravel new mySite
the following message is deployed:
Crafting application...
sh: 1: composer: not found
Application ready! Build something amazing.
It's looks like some trouble with composer, but I don't know why. Composer seems to work, so, what is wrong? Thank you!
I got the same error.
I fixed it with simple symlink.
locate it. Run: # whereis composer
composer: /usr/local/bin/composer.phar
then create link: # sudo ln -s /usr/local/bin/composer.phar /usr/local/bin/composer
Thats it. All works.
If you run composer on shell, does it run? otherwise run:
sudo apt-get install curl php5-cli git
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
Then try again, maybe you could try the composer installation syntax:
composer create-project --prefer-dist laravel/laravel blog
To be sure composer is updated to the latest version and nothing is in cache run:
composer self-update
composer clear-cache
I still can't use laravel new, but I found what was happening with composer.
Laravel 5.3 needs php5.6 or higher, otherwise will run an older laravel version. I upgrade to php5.6 with this steps: https://www.dev-metal.com/install-setup-php-5-6-ubuntu-14-04-lts/
then run
composer create-project laravel/laravel ProjectName
and it's done!
Hey just started working on laravel. First day for me. Not much idea. Step by step following the steps from documentation given by https://www.laravel.com
After installing composer on my desktop at root folder. As soon, i opened composer.phar, it showed this error -> there is a problem opening the file "/root/composer.phar"
I followed steps given in https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx .
apt-get install curl
apt-get install php5-cli
curl-sS https://getcomposer.org/installer | php
php composer.phar
Is there any problem ? Please help me........
For installing composer try follow this
sudo apt-get install curl
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
sudo chmod +x /usr/local/bin/composer
Setting up Laravel
Run only composer and see if composer is installed.
If yes then let's install laravel installer to quickly install laravel. Run this command from your command line composer global require "laravel/installer=~1.1"
Now if you are using zsh then add this line to user home directories .zshrc file export PATH="~/.composer/vendor/bin:$PATH"
Else add this lines to .bashrc file export PATH="~/.composer/vendor/bin:$PATH"
Now you can run laravel new blog and a new laravel installation will be downloaded.
Now run php artisan serve from that directory to serve your laravel
See http://laravel.com/docs/5.1/#installation for more details
Tips: You can create a separate file and include it to your
.zshrc or .bashrc
While installing laravel on windows via laravel installer with command composer global require "laravel/installer=~1.1" then laravel new project-name , it now instal laravel 5.0, latest version. How to install laravel 4.2 version via laravel installer with laravel new command??
No that's not possible with the laravel installer. It will always get the latest release. Here's the source of the laravel new command
protected function download($zipFile)
{
$response = \GuzzleHttp\get('http://cabinet.laravel.com/latest.zip')->getBody();
// ^^^^^^^^^^
file_put_contents($zipFile, $response);
return $this;
}
What you can do is use composer create-project and specify the version:
composer create-project laravel/laravel project-name ~4.2.0 --prefer-dist
By the way ~4.2.0 means that you will get the latest version with 4.2.* (currently that's 4.2.11)
This works for me on top of homestead:
$ composer create-project laravel/laravel YOURFOLDERNAME 4.2.*
Note the * for the version #.
Outputs:
Installing laravel/laravel (v4.2.11)
- Installing laravel/laravel (v4.2.11)
Downloading: 100%
If you don't plan to create multiple 4.2 projects, you can install single one by issuing another Composer command:
composer create-project laravel/laravel foldername "4.2" --prefer-dist
where foldername is a name of folder for your project and "4.2" specifies version to install.
I tried it on my Windows 7 machine just now, it works.
P.S. Laravel documentation shows slightly different syntax:
composer create-project laravel/laravel "4.2" --prefer-dist
but this creates 5.0 installation in folder named "4.2".
Delete XAMMP and/or Homestead
Install Laragon (http://laragon.org/)
This should solve the problem. Happy Programming
This should do the work.
composer create-project laravel/laravel {{projectName}} 4.2.* --prefer-dist
Download git bash
cd /opt/lampp/htdocs
and run
composer create-project laravel/laravel [name] 4.2.* --prefer-dist
where [name] is your projects name.
It's better to use composer
composer create-project laravel/laravel {directory} 4.2 --prefer-dist
Just open your power shell and cd to the directory you want to run the project, and run the above command, make sure you have composer first.