Unable to Install Laravel 4.1 on Maverics OS X - laravel

I am trying to install laravel 4.1 on Maverics OS X using the document provided on the laravel site.
I am trying only two methods provided: via laravel installer & via composer. The third option is not preferred because I will only be able to apply these two methods on my production server.
I get following errors
a) Using via laravel Installer: I issue following commands (assuming I have downloaded in downloads dir)
downloads$ mv laravel.phar /usr/local/bin
cd ~/rohinigeeks
rohinigeeks$ sudo laravel rohinigeeks
ERROR:
sudo: laravel: command not found
b) Using Via Composer. I issue following commands
composer create-project laravel/laravel rohinigeeks --prefer-dist
ERROR:
[ErrorException]
unlink(/Users/apple/.composer/cache/files/symfony/security/ef511d47c94ad92e
37112b43efcbf7da8696a803.zip): Permission denied
Your help will be appreciated.
-AK

You installed laravel.phar in /usr/local/bin, so use that as the command name. Or rename it to /usr/local/bin/laravel:
mv laravel.phar /usr/local/bin/laravel
Also make sure it's executable:
chmod a+x /usr/local/bin/laravel
And if you're using tcsh (is this still the OSX default?), make sure to use rehash.

Related

Composer not found error on MacOs Terminal

To install Laravel on latest macOS Monterey 12.5, I installed HomeBrew, used that to install php, then used instructions on Composer.Org to install composer which installed composer.phar on my current directory.
I added my current directory to PATH. But could not run Composer. Then created a directory /usr/local/composer and did "sudo mv composer.phar .." into that directory, which did move the file. Then created a .zshrc file in my current directory and added both my current directory and /usr/local/composer on permanent PATH.
But I still can't invoke composer. zsh gives me "command not found: composer".
I am very new to this. Am I making noob mistakes? Thank you very much for any pointers.

How to install composer globally for laravel app in windows?

I have a question related to composer and laravel. My question is whenever I install the fresh laravel app using command :
composer create-project laravel/laravel blog
Inside my C://xampp/htdocs/ directory and then change path to C://xampp/htdocs/blog/, here I am unable to run the composer command but I had already installed composer from its official website globally in C://xampp/htdocs/ directory. So is there any way to use composer command globally whenever I install fresh laravel app, so that I don't want to install composer in the laravel app directory everytime.
Now I guess they provide direct setting up global installation,
Check here
I did it like this a lot earlier,
Change to the path (or you can add that directory to your path later), and run the installer as mentioned on composer download site to download composer.phar.
Create a new composer.bat file alongside composer.phar.
Using cmd.exe:
run
echo #php "%~dp0composer.phar" %*>composer.bat
Then set it to path environment variable(see this)
Test with a new terminal:
composer -V
Will return
Composer version 1.10.6 2020-05-06 10:28:10
go to composer website and download the exe file, you should have it gloablly if you install it that way.
Good luck ^_^

Where can i find a hyperlink to symfony 2.7

I can't download the zip file symfony2.7. The link on the website doesn't work. Does anyone know why? Where can i find the symfony 2.7-zip file? I found an older version somewhere on the internet but i would really like the latest stable version.
if you really MUST have a zip : https://github.com/symfony/symfony-standard/archive/2.7.zip
also, a simple search would have revealed this
Wich is where i got this answer form .. so yea, use search next time ...
use the symfony installer, as documented on their website here
snip
Linux and Mac OS X Systems:
Open your command console and execute the
following commands:
sudo curl -LsS http://symfony.com/installer -o /usr/local/bin/symfony
sudo chmod a+x /usr/local/bin/symfony
This will create a global symfony command in your system.
Windows Systems:
Open your command console and execute the following
command:
c:\> php -r "readfile('http://symfony.com/installer');" > symfony
Then, move the downloaded symfony file to your project's directory and
execute it as follows:
c:\> move symfony c:\projects c:\projects\> php symfony
snip
You can then use it to install a specifi version using
symfony new my_project_name 2.x.x
I always used to install it through or via the create-project command:
composer create-project symfony/framework-standard-edition project_name
If you want a 2.7 version
composer create-project symfony/framework-standard-edition project_name '2.7.*'
if there is no 2.7 stable version at the time of this writing, you need to lower the stability to dev:
composer create-project symfony/framework-standard-edition project_name '2.7.*' -s dev
-s (--stability.)

Can't create projects with Composer on Windows 7

I'm trying to install Laravel with composer on Windows 7 and am running into an error. This is the command I'm running:
composer global require "laravel/installer=~1.1"
This is the error I get:
file_put_contents(C:\Users\myUser\AppData\Roaming\Composer/vendor/composer/installed.json): failed to open stream: No such file or directory
It's correct to say that the installed.json file does not exist, there's not even a composer folder inside the vendor folder. Not sure why that would be missing. I installed composer using the Windows installer.
Seems to be a composer related issue rather than laravel. I just tried installing yii and am getting a similar error running this:
composer create-project --prefer-dist yiisoft/yii2-app-basic MyApp
For this one, I get this after it successfully creates the folder and seems to load most files:
file_put_contents(C:\wwwroot\MyApp/vendor/composer/installed.json): failed to open stream: No such file or directory
Seems like the problem is that I never have a composer folder in my vendor folder.
UPDATE
I was able to get laravel to install globally by adding the COMPOSER_HOME environment variable. But I still run into a similar error when setting up a Laravel project after that
UPDATE 2
Some additional info, when I use the Windows Installer, composer gets installed in c:\ProgramData\ComposerSetup\bin. If I set the COMPOSER_HOME environment variable to this, laravel can get installed globally. But trying to install a project using the "laravel new MyApp" throws the following error:
Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in C:\wwwroot\MyApp\artisan on line 31
I suspect that's because I have PHP 5.4 and the latest version of laravel is 5.6 and above, but I want to install 5.0, which is 5.4 and above. I tried doing it using "composer create-project laravel/laravel MyApp 5.0 --prefer-dist" instead. I get the following error:
file_put_contents(c:\wwwroot\MyApp/vendor/composer/installed.json): failed to open stream: No such file or directory
Seems there's just something weird going on with paths that I can't quite figure out.
UPDATE 3
I've now uninstalled composer and re-installed it manually per the instructions provided on the composer site. I'm now trying to create a project using the following command from c:\wwwroot:
composer create-project laravel/laravel c:\wwwroot\MyApp --prefer-dist
It does manage to install some stuff, but seems I get this error before any package it tries to install:
Installing laravel/laravel (v5.1.4)
Loading from cache
Failed to download laravel/laravel from dist: RecursiveDirectoryIterator::__construct(C:\wwwroot/vendor/composer/,C:\wwwroot/vendor/composer/): The system cannot find the path specified. (code: 3)
Again, seems like it can't create a directory for vendor/composer for some reason. I tried running the same command, but from inside an empty c:\wwroot\MyApp folder, same result except the path in the error changes accordingly.
I found the following: https://getcomposer.org/doc/articles/troubleshooting.md#-the-system-cannot-find-the-path-specified-windows-
But I checked my registry and I have none of these entries. So still no clue.
It seems that your composer is not globally accessible. Try to add C:\Users{UserName}\AppData\Roaming\Composer\vendor\bin to your environment variable then restart your Shell or Command-Prompt so that updated Path variables is loaded. Now try to install laravel again.
Here is the detailed instruction:
Go to Control Panel > Systems ans Security > System > Advanced system settings then navigate to envirinment variables then scroll down and locate the PATH then add a semi colon (;) at the end of the PATH string. This means you are declaring a new variable. Then paste the C:\Users{UserName}\AppData\Roaming\Composer\vendor\bin after (;) you have added, restart the command prompt and try to install laravel again.
Uninstall composer and install it again, but this time do enable shell menu. Right click on the location (directory) where you want to create the project, select "use composer here", then "composer create-project laravel/laravel projectName --prefer-dist" should create your laravel project, default to latest version (5.1).
To specify your prefer version:
"composer create-project laravel/laravel 4.2 projectName --prefer-dist"
I will suggest you to install Homestead (http://blog.teamtreehouse.com/laravel-homestead-on-windows) and do all the heavylifting there.
You just need to do homestead ssh to actually connect to your machine and then perform all your operations.
Windows is pretty unpredictable in that kind of situations and in web development in general.

creating new laravel application on mac by laravel installer

I have been strugling to create an application with laravel installer from terminal.
I have globally installed composer and laravel..
however i constantly get this error:
If you check at the bottom of the screenshot you can see -bash: new: command not found however laravel command is being executed perfectly. My osx version is 10.10.2. Macbook pro.
Any help will be appreciated.
Another question (bit out of the topic)
Is git inbuild in mac osx?
Cuz i hadn't installed it but it shows all of its commands.
Regards,
=======================
I created alias for composer and laravel in .bash_profile and .bashrc and it worked however now I'm getting this error :
Prajwols-MacBook-Pro:htdocs prajwol$ laravel new test
Crafting application...
Warning: ZipArchive::extractTo(): Invalid or unitialized Zip object in /Users/prajwol/.composer/vendor/laravel/installer/src/NewCommand.php on line 99
Warning: ZipArchive::close(): Invalid or unitialized Zip object in /Users/prajwol/.composer/vendor/laravel/installer/src/NewCommand.php on line 101
Application ready! Build something amazing.
Result : An empty folder is created called test in destination folder.
The command needs a project name: laravel new <NAME>. Like laravel new blog. This will create a new laravel project in a new blog directory in the current path.
$ brew tap homebrew/homebrew-php
$ brew install php72
Install composer
$ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
$ php composer-setup.php --install-dir=/usr/local/bin --filename=composer
Install Laravel
$ composer global require "laravel/installer"
$ composer global -vvv require "laravel/installer"
now run command
composer

Resources