How do install Laravel - php

The help has a load of different options. I tried:
composer global require "laravel/installer=~1.1"
which returns:
[RuntimeException]
Not enough arguments.
And then there is a load of articles referencing the windows installer located at:
http://laravel.com/laravel.phar
Which says:
"Whoops, looks like something went wrong."
I'm not sure what else to try? Am I missing something?

This should have worked, maybe the tilde needs escaping on your shell (\~), or you could try one of the other formats accepted by the command :
Usage:
require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-update] [--update-no-dev] [--update-with-dependencies] [packages1] ... [packagesN]
Arguments:
packages Required package with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"

Here u can see the installation instructions:
http://laravel.com/docs/4.2/installation
It comes down to this:
Install composer
Download laravel
Put it in the www folder of wamp so you have www/laravel-master
Right click in the root of laravel-master and select composer install
Ready to go
I assumed u use WAMP, if u use something else, put laravel in the map where all your projects are located.

If you are using MAMP, this youtube video will help. It did help me, although I admit in the end it's not as clear as I want it to be.
Anyways, I made my own notes just in case i have to do it again.
a. add MAMP's PHP to PATH VARIABLE in .bash_profile
export PATH=/Applications/MAMP/bin/php/php5.5.10/bin:$PATH
maybe not necessary step if you have an updated php with mcrypt, I just chose to use MAMP's php
b. install Composer
go to http://www.getcomposer.org/ ->getting started ->globally copy and execute 2 commands,
at the terminal…
cd ~
curl -sS https:/?getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
c. install Laravel at MAMP/htdocs folder using composer,
at 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
e. using any textEditor edit /Applications/MAMP/conf/apache/httpd.conf
uncomment by removing the # before include… on the 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 textEditor edit /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's 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 things to note
1. set ServerName to your projectName(neji.dev)
2. set DocumentRoot to the public folder
g. open your project using your fav browser
neji.dev/
**don’t forget the / at the end
You should see the laravel welcome page.
Then after a few days switch to VM :)

Related

Laravel installation & configuration 5.2

Im new to laravel.I've downloaded the laravel 5.2 Via Composer Create-Project.
composer create-project --prefer-dist laravel/laravel blog "5.2.*"
Im using xampp
When i run the project in my chrome browser http://localhost/blog/,
`
Hope help & support
copy .htaccess from the public directory and paste it in the root directory
rename the server.php at the root directory to index.php
visit http://localhost/blog/
I think you can try this:
First open terminal/cmd and write you project full path.
After that run php artisan serve command and it will start the server and give you a url like (http://127.0.0.1:8000).Open the URL in browser. You can see your project running.
Hope this help you
You need to create virtual host for your project.
<VirtualHost laravel.dev:80>
DocumentRoot "C:\xampp\htdocs\laravel\public"
ServerAdmin laravel.dev
<Directory "C:\xampp\htdocs\blog">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
For more information check this guide.

How to run Laravel project on normal Apache?

I have Laravel project and can run it with
php artisan serve
I am executing this command inside D:\Users\Dims\Design\MyApplication directory. After that I can see site on http://localhost:8000 and can navigate it, although slow.
Now I am configuring the same place to serve by apache:
<VirtualHost *:80>
ServerAdmin webmaster#myapplication.app
DocumentRoot "D:\Users\Dims\Design\MyApplication\public"
ServerName myapplication.app
ErrorLog "logs/myapplication-error.log"
CustomLog "logs/myapplication-access.log" common
<Directory />
AllowOverride none
Require all granted
DirectoryIndex index.php
</Directory>
</VirtualHost>
Not, that I pointed application not to the root of the project, but to the public directory. This makes me able to open home page of the site, but clicking any links causes error 404.
If I serve
DocumentRoot "D:\Users\Dims\Design\MyApplication"
with Apache, I am unable to see home page at all, saying 403 forbidden. This probably because this directory has no index.php.
So, is it possible to serve Laravel project with Apache?
Yes, it's absolutely possible to serve Laravel applications with Apache. To debug why your links are producing 404 errors, you'll have to provide more information about the URLs these links point to. It's best to always use Laravel's url(), secure_url() or route() helper functions when printing URLs. Also confirm that the Apache module mod_rewrite is enabled (Laravel Installation: Web Server Configuration)
Set up the apache server host file as shown below:
<VirtualHost *:80>
ServerAdmin user#email.com
DocumentRoot D:\Users\Dims\Design\MyApplication\public
ServerName exampledomain.com
ServerAlias www.exampledomain.com
ErrorLog "C:/some_dir/example.error.log"
CustomLog "C:/some_dir/example.access.log" combined
<Directory "D:\Users\Dims\Design\MyApplication\public">
Options -Indexes
DirectoryIndex index.php index.html
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Now that you have set the server name to exampledomain.com you also need to set up the hosts(DNS) file in windows so that you can type in exampledomain.com in your browser and access your laravel project.
Editing the hosts file:
Please follow the steps below:
Press the Windows key.
Type Notepad in the search field.
In the search results, right-click Notepad and select Run as
administrator.
From Notepad, open the following file:
c:\Windows\System32\Drivers\etc\hosts
Make the following changes to the file.
At the end of the file add the following line:
127.0.0.1 exampledomain.com www.exampledomain.com
Click File > Save to save your changes.
What we did here was to tell windows that when we try to access exampledomain.com or www.exampledomain.com do not try to find the server over the internet but take the request to the local machine itself(127.0.0.1) which will in return serve your laravel project.
You can also find one another method here at wikihow -> http://www.wikihow.com/Install-Laravel-Framework-in-Windows
If after configuring the virtualhost you're still unable visit your laravel app, but it works fine with artisan serve, check your apache php version:
Check /etc/apache2/mods-enabled and if the php module is lower than the one required in laravel specifications, update it. In my case:
$ a2dismod php7.0
$ a2enmod php7.2
$ service apache2 reload
Solution found at: https://laracasts.com/discuss/channels/laravel/unexpected-illuminatesupportarrphp-on-line-388

How to set an environmental variable in Apache (or OS) and get the value in PHP?

I made sure the env module was installed:
a2enmod
Your choices are: access_compat
...
Which module(s) do you want to enable (wildcards ok)?
env
Module env already enabled
I tried setting an environmental variable in "/etc/apache2/apache2.conf" for localhost by adding the following section:
<VirtualHost *:80>
ServerName localhost
ServerAdmin me#somewhere.com
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SetEnv devmode 1
</VirtualHost>
...restarted Apache using:
sudo /etc/init.d/apache2 restart
...and then getting the value in PHP using:
getenv("devmode")
or:
apache_getenv("devmode")
...but nothing shows up with these functions when accessing the script via a browser on localhost, the values are empty in PHP. I tried placing the command on it's own, without the VirtualHost section:
SetEnv devmode 1
I tried adding the following line to envvars:
export devmode=1
Update
I also tried putting the VirtualHost section in a dedicated file in /etc/apache2/sites-available, and adding the file with a2ensite.
I am using Linux Mint version 17.3. What am I doing wrong?
Have you tried apache_getenv ?
After putting the VirtualHost section into a dedicated file, as I described in the original question, I found that the solution was to run the Apache restart command again:
sudo /etc/init.d/apache2 restart
Then the devmode variable showed up in PHP.

I can't seem to get started with Zend Framework 2 skeleton app

I'm following through the getting started skeleton app tutorial on the Zend homepage:
http://framework.zend.com/manual/2.2/en/user-guide/skeleton-application.html
I've got as far as being able to enter into the browser address bar "zf2-tutorial.localhost/" and my Zend welcome page should appear. It doesn't, the apache web folder (/var/www) directory appears instead. If I enter "http://zf2-tutorial.localhost/1234" to test whether the Zend 404 page appears, it doesn't. The default apache Not Found page appears.
I created my app by running in terminal:
php composer.phar create-project --repository-url="http://packages.zendframework.com" zendframework/skeleton-application:dev-master /var/www/zf2-tutorial
.. this created all the files in the desired folder (/var/www/zf2-tutorial).
I then created the file /etc/apache2/sites-enabled/zf2-tutorial with the following:
<VirtualHost *:80>
ServerName zf2-tutorial.localhost
DocumentRoot /var/www/zf2-tutorial/public
SetEnv APPLICATION_ENV "development"
<Directory /var/www/zf2-tutorial/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
I updated my /etc/hosts file with:
127.0.0.1 zf2-tutorial.localhost localhost
I restarted apache
sudo service apache2 restart
.. and by this point I should be able to see the Zend welcome page so I can proceed with the rest of the tutorial but nothing.
By the way, I'm using Ubuntu 12.04, Apache/2.4.9 (Ubuntu) and PHP 5.5.14.
Is there anything obvious that I've missed out? I've got a feeling that it has something to do with the mod_rewrites but I'm a little confused which I should be updated and how. Any help would be much appreciated.
Add the
<VirtualHost *:80>
[... same code ....]
</VirtualHost>
in the /etc/apache2/sites-enabled/000-default file and restart the apache2
Update -
If it still doesn't work then try the below command and check -
sudo a2enmod rewrite
sudo service apache2 restart
This will enable the rewrite module if not already is.
After entering the URL in the browser, if the required page is not displayed then check the apache error log file located at /var/log/apache2/error.log
By this, you could get some idea as where its going wrong.
Your problem was in config file name. In directory sites-enabled files should have .conf in the end of name.
Good: zf2-tutorial.conf
Bad: zf2-tutorial

Installing Bonfire for Codeigniter Server and Install link issues

I'm trying to install Bonfire for Codeigniter and I'm having some issues. I first tried downloading the zip, unziping it and placing it in MAMP and navigating to it through localhost. The welcome page came up but when I clicked on the "install" button, it displayed a "URL Not Found" page. Quite annoying since I'm under the gun.
I saw on youtube, that the dev team shows the install by cloning the repo on Github so I tried that next. Now when I load that in my localhost, I get a welcome page without an install button, an error saying my "htaccess" should be renamed ".htaccess" (although when I looked at the file it looked fine to me) but more worryingly is the next error:
"Oops!
Your Web Root should be set to the public folder,but it's not. It's pointing to the Bonfire Root folder.
See below how your site should be set up on Apache:
<VirtualHost *:80>
DocumentRoot "[...]/htdocs/Bonfire_Root/public"
ServerName Bonfire.Root
ServerAlias Bonfire.Root.local
</VirtualHost>"
I'm a really junior programmer and I'm just trying to get this sorted out quickly because of a project I'm on that I need to turn around quickly. I'm sure this is probably something simple so does anyone know what I can do to fix this so it will work and I can begin developing with Bonfire? Thanks in advance!
EDIT:
When I followed the instructions about adding my project name to the URL, I moved on to a blank page, Chrome initiated a download of a textfile called install which contains this:
J
5.5.34B:;Z1&hZˇ˜Äj*/Knh#G"o/9mysql_native_password!ˇÑ#08S01Got packets out of order
I'm not sure what to do with this. Any ideas?
I've tried:
http://localhost/Bonfire_Root/public/
http://localhost/Bonfire_Root/public/index.php
http://192.1xx.xxx.xxx/Bonfire_Root/public/index.php
Each time it just downloads the textfile with the same text in it. :/
here's my work around (I'm on linux btw):
1) make sure mod_rewrite is enable on your apache setup.
2) add <VirtualHost *:80>
DocumentRoot "/path/to/your/htdocs/bonfire/public"
ServerName bonfire.dev
ServerAlias bonfire.dev
<Directory "/path/to/your/htdocs/bonfire/public/">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
3) edit your /etc/hosts file, add this line 127.0.0.1 Bonfire.Root
4) restart your apache
5) access bonfire on http://bonfire.dev, instead of http://localhost/Bonfire_Root/public
hope it helps
I would suggest no need to use htaccess if you are working on local environment.about your error when you click on install button after that in your url put your project folder name like 'host:port/yourprojectname/public/index.php' . would redirect to you next page to get installation process done.
I had same problem but in windows yes working on mac and windows quite similar. When i clicked on install it goes to http//localhost/public which is not correct url so i have change by adding my project name after localhost http//localhost/project/public/index.php.
Major difference between mac and window while using PHP is s you have to use ip address in place of localhost.
Assuming you are installing bonfire in windows D:\ drive and path of you index.php is "D:/xampp/htdocs/bonfire" please follow below steps:
1. Edit your `D:/xampp/htdocs/bonfire/index.php` file
<VirtualHost 127.0.0.1:80>
DocumentRoot "D:/xampp/htdocs/bonfire"
ServerName 127.0.0.1
ServerAlias bonfire.dev
</VirtualHost>
Open your httpd.conf file (in case of xampp path will be D:\xampp\apache\conf\httpd.conf) and add this in the end of your file.
NameVirtualHost localhost
<VirtualHost localhost>
DocumentRoot D:/xampp/htdocs/bonfire
ServerName localhost
<VirtualHost>
#####
## myproject.dev
## DOMAIN of myproject
#####
NameVirtualHost bonfire.dev
<VirtualHost bonfire.dev>
DocumentRoot D:/xampp/htdocs/bonfire/public
ServerName bonfire.dev
</VirtualHost>
note that bonfire.dev is a naming convention i have given to my website and mentioned it inside my C:\Windows\System32\drivers\etc\hosts file so as convenient to you, choose any name suitable to you
Edit C:\Windows\System32\drivers\etc\hosts file.
Add below lines in hosts file.
127.0.0.1 localhost
::1 localhost
127.0.0.1 bonfire.dev
4. Restart Apache and now open your web page `http://bonfire.dev/`
This solution works 100%, I have been fighting up with same issue and now finally its fixed. Just try it and get back to me in case of any issue.
launches the PHP server into the directory of your project exempel
www / (project) / public / php -S localhost: (port)

Categories