Install Laravel on MAMP

I downloaded the latest version of Laravel from Github, unzipped it, and then put it in the htdocs folder in MAMP. MAMP works with PHP version 5.4.10 and therefore complies with the Laravel requirement for PHP> = 5.3.7. I tried using the terminal to install the composer by typing:

curl -sS https://getcomposer.org/installer | php 

And was met with an error:

  #!/usr/bin/env php Some settings on your machine make Composer unable to work properly. Make sure that you fix the issues listed below and run this script again: The detect_unicode setting must be disabled. Add the following to the end of your `php.ini`: detect_unicode = Off A php.ini file does not exist. You will have to create one. If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times. 

When i try to load

 http://localhost:8888/laravel/public/ 

in my browser, the PHP error log shows

 05-Sep-2013 16:57:03 Europe/Berlin] PHP Fatal error: require(): Failed opening required '/Applications/MAMP/htdocs/laravel/bootstrap/../vendor/autoload.php' (include_path='.:/Applications/MAMP/bin/php/php5.4.10/lib/php') in /Applications/MAMP/htdocs/laravel/bootstrap/autoload.php on line 17 

I have the feeling that this error has a fairly simple solution, but since I am very new to Laravel, I need to point in the right direction regarding the solution to this issue.

Thanks.

+4
source share
6 answers

You need to start Composer before you can install Laravel 4. This step failed here.

Try this command:

 $ curl -sS getcomposer.org/installer | php -d detect_unicode=Off 

This will work around the problem so that you can continue installing Laravel 4.

EDIT:

To install Composer globally, follow these steps:

 $ sudo mv composer.phar /usr/local/bin/composer.phar $ alias composer='/usr/local/bin/composer.phar' 

Then in your directory where you would like to include Laravel 4,

 $ php composer create-project laravel/laravel --prefer-dist 
+18
source

I had the same problem, your system does not use MAMP PHP , but instead uses the PHP that comes with your mac.

I took notes on how I installed laravel when MAMP already installed. Hope you and others find this helpful.

a. add MAMP PHP to PATH VARIABLE in .bash_profile

 export PATH=/Applications/MAMP/bin/php/php5.5.10/bin:$PATH 

b. install Composer -go to http://www.getcomposer.org/ β†’ getting started β†’ copy globally and execute the following commands on the terminal ...

 cd ~ curl -sS https:/?getcomposer.org/installer | php sudo mv composer.phar /usr/local/bin/composer 

c. install laravel in the MAMP/htdocs folder using Composer , on the terminal ...

 cd /Applications/MAMP/htdocs composer create-project laravel/laravel neji --prefer-dist 

** where neji is the name of your website / project

d. edit /private/etc/hosts

 sudo nano /private/etc/hosts 

add 127.0.0.1 neji to the buttom file. save and exit

e. using any editing of the text editor /Applications/MAMP/conf/apache/httpd.conf uncomment, deleting # before turning it on ... on virtual hosts, see below, where ...

  # Virtual Hosts #Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf 

becomes ...

  # Virtual Hosts Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf 

f. using any text editing editor /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf add the following text at the bottom

 # I am not sure about this since DocumentRoot does not points to the public folder # but I still added it and it working, maybe someone will clarify this part <VirtualHost *:80> ServerAdmin localhost DocumentRoot "/Applications/MAMP/htdocs" ServerName localhost ServerAlias www.localhost # ErrorLog "logs/dummy-host.example.com-error_log" # CustomLog "logs/dummy-host.example.com-access_log" common </VirtualHost> # this one, I think is the code that makes it work bec the DocumentRoot points to public folder <VirtualHost *:80> ServerAdmin neji.dev DocumentRoot "/Applications/MAMP/htdocs/neji/public/" ServerName neji.dev ServerAlias www.neji # ErrorLog "logs/dummy-host.example.com-error_log" # CustomLog "logs/dummy-host.example.com-access_log" common </VirtualHost> 

** 2 notes

1, set the ServerName name to your project name (neji.dev)

2nd, install DocumentRoot in the shared folder

g. open your project using your fav browser

 neji.dev/ 

** don't forget / at the end

You should see a laravel welcome laravel .

Then after a few days, switch to VM :)

+2
source

Try the instructions at this link. This worked for me: http://forumsarchive.laravel.io/viewtopic.php?id=16363

+1
source

It looks like you are missing out on dependencies.

Installing the documentation is pretty straightforward:

Once Composer is installed, download the latest Laravel structure and extract its contents into a directory on your server. Then, at the root of your Laravel application, run the php composer.phar install (or linker) command to install all the structure dependencies. For the installation to complete successfully, this process requires installing Git on the server.

You have already downloaded and unpacked Laravel files into your htdocs folder, so now just run:

 php composer.phar install 

in your terminal to install dependencies.

This should solve the problem.

And when you want to update Laravel, just run:

 php composer.phar update 

Hope this helps!

0
source

The problem is that when you "install" MAMP, the php command in the terminal does not use PHP MAMP, but Mac OS by default

Just enter the terminal: which php it returns: / usr / bin / php

To install Laravel without additional parameters, just update the .bash_profile file to use PHP MAMP

I wrote a document (in French) here:

https://docs.google.com/document/d/1eXaL8mAv7bGQ_xq_f6sO5jf23X7APuRwCDAexHN52mY/edit

considers

0
source

In addition to determining which version of php you are using:
which php
and editing the path in .bash_profile (as others have already explained very well), be sure to check if php exists in / usr / bin
ls /usr/bin/php
and if so, disable it by renaming it to something like php.bak
cd /usr/bin
sudo mv php php.bak
In my case, I did all the reset of the path variable in .bash_profile plus permission checks plus the subsequent discussion of a bunch of debates about other ways to configure the path variable, etc., but in the end, my problems were solved by disabling the old php in / usr / bin in general .

0
source

Source: https://habr.com/ru/post/1500750/


All Articles