Wamp 3.1.3 Windows Environment PATH conflict [duplicate] - composer-php

This question already has answers here:
How To Run PHP From Windows Command Line in WAMPServer
(12 answers)
Closed 4 years ago.
I just installed Wamp 3.1.3, and then installed composer.
The composer added the path to php.exe to windows environment variables. But now Wamp shows error in context menu , that when clicked shows this message:
There is an error.
There is Wampserver path (c:/wamp64)
into Windows PATH environnement variable: (C:\wamp64\bin\php\php7.2.4)
It seems that a PHP installation is declared in the environment variable PATH
C:\wamp64\bin\php\php7.2.4
Wampserver does not use, modify or require the PATH environment variable.
Using a PATH on Wampserver or PHP version
is detrimental to the proper functioning of Wampserver.
Now if I remove the path, wamp is happy, but composer would complain that php is not recognized program, and otherwise composer works but wamp complains to remove the path.
Any workaround?

Install the Composer manually:
Create bat script called composer.bat inside any directory within the PATH so it's system wide containing:
#C:\your\absolute\path\to\php.exe "%~dp0composer.phar" %*
Next time you change PHP simply update the path. Or you can have multiple scripts like composer-php6, composer-php7 etc. calling multiple php
versions. Just remember to put the composer.phar alongside your batch script.
No need to update the PATH at all. Good luck.

Related

Shopware 6 - The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly

i just wanted to install the newest Shopware version 6.4.16.1 and i get this failure:
The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly
i have composer installed and the home and composer_home variables are available on the server. what am i doing wrong? i have never got any error like that
This is indeed a known issue, which was fixed in the upcoming v6.4.17.0 release, see the official ticket.
A workaround for now would be to add a .env in the root directory with following content:
COMPOSER_HOME="/var/cache/composer"
If you already have a .env there just add that line.

Composer not working on command prompt Windows 7

I installed Composer via Composer windows installer and it installed to the path C:\ProgramData\ComposerSetup. The composer.phar file is in the bin folder in the directory (C:\ProgramData\ComposerSetup\bin). I have added the Composer PATH to the environment variable. But even after that, I can't make Composer get start by typing composer in the command prompt. Can you help me? I have tried installing it manually in different directories and so far no success.
I have downloaded Console2 and inside it, Composer works just fine. But the windows command prompt doesn't do anything unless I'm in the installation directory.

Installing Laravel via the Laravel installer

I have composer installed, but checking the Laravel docs, I'm struggling with:
"Make sure to place the ~/.composer/vendor/bin directory in your PATH so the laravel executable is found when you run the laravel command in your terminal."
I'm not sure what to do here, could someone explain it to me?
Go to terminal and paste the next line:
nano ~/.bash_profile
After that paste the next line in nano:
export PATH="$PATH:$HOME/.composer/vendor/bin"
Done. Restart your terminal and enjoy laravel.
The PATH environment variable tells your system where to look when you run a command. By default ~/.composer/vendor/bin will not be in your PATH. Therefore, if you just attempt to run the command laravel after installing it via composer, your terminal will give you an error saying the command is not found. But if you use the entire path to the command (~/.composer/vendor/bin/laravel), it will execute successfully.
When you run the command composer global require "laravel/installer=~1.1", composer puts the laravel installer into the directory ~/.composer/vendor/bin (in *nix, ~ represents your home directory). Adding ~/.composer/vendor/bin to your PATH allows you to just execute the command laravel instead of having to use the full path of ~/.composer/vendor/bin/laravel.
Helpful Stuff:
How to set/change your PATH environment variable in OSX
Installing composer packages globally

How to install Laravel via Laravel Installer on Windows?

I’m trying to install the Laravel Framework on Windows with the Laravel Installer method.
In the documentation I found the following:
First, download the Laravel installer using Composer. Make sure to
place the “~/.composer/vendor/bin” directory in your PATH so the
laravel executable is found when you run the laravel command in your
terminal.
Now this PATH does not look familiar to me. Could you tell me the working path for Windows?
BTW: I’m using WAMP. Composer is installed and updated.
The PATH for Windows:
I’ve found the location where composer stores the Vendor files.
So instead of ~/.composer/vendor/bin, on Windows the following path should be used:
C:\Users\<COMPUTER NAME>\AppData\Roaming\Composer\vendor\bin
How to install the Laravel Installer:
=======
I assume you have php and composer in your PATH already.
First of all install the Laravel Installer. Open a command prompt and enter:
composer global require "laravel/installer=~1.1"
**Then update the PATH environment variable** via e.g. command prompt with admin privileges:
set PATH=%PATH%;%USERPROFILE%\AppData\Roaming\Composer\vendor\bin
// setx /M path "%path%;%appdata%\Composer\vendor\bin" (this may destroy your system)
%appdata% is added, so you don’t have to worry about adding your computer name.
How to create a fresh Laravel Installation:
Now you should be able to run laravel commands in the command prompt.
To create a fresh laravel installation, open a command prompt in the directory of choice and enter:
laravel new name_of_directory
If everything went right, you should see the following message:
Crafting application...
Application ready! Build something amazing.
Use Laragon (http://laragon.org/)
Install Laragon.
Use Laragon Menu to create project
Take you 5 minutes to have Laravel4 o Laravel5.
Launch Laragon Project
Laragon automatically create Virtual host for your project name ( project_name.me)
Hope it helps.
Source: https://innopy.wordpress.com/2015/02/07/laravel-windows/
If you are having trouble using the command prompt, use the GUI approach:
The path in Windows is:
C:\Users\UserName\AppData\Roaming\Composer\vendor\bin
In the above path "UserName" is your user name that you are logged in your computer as. If you don't know your username, go here: http://library.queensu.ca/libguides/computers/windows-username-check.htm
Copy the above path, replace the "UserName" with your username.
Then go to your computer's environment variables. Here's how:
Right click on your Computer and go to properties
Go to Advanced system settings
Under Advanced Tab, Click on Environment Variables
Under User Variables, select Path and click Edit:
Put a semicolon at the end of the existing text and paste your path, example:C:\ProgramData\ComposerSetup\bin. Press OK ...
Restart your command prompt and type laravel and hit enter. If the path was successfully set, you will see "Laravel Installer Version ... "
How to install Laravel on Windows using WAMP
Install WAMP first.
I leave everything to default.
Enable OpenSSL and all required extensions in PHP.ini
After you installed WAMP, you need to do this. This is how you make sure OpenSSL is enabled:
On your right hand side of your taskbar, click WAMP and then choose PHP.ini.
And then find php_openssl, and then remove the semicolon in front of php_openssl.
And then, save. Close that file and now go to wamp manager again, and now enable OpenSSL there just to be safe.
After you do that, restart Wamp.
Install Composer
Go to https://getcomposer.org/ and download Windows installer.
The setup will ask for your PHP. if you install your WAMP in default setting, it will usually end up in C:\wamp\bin\php\php5.4.12.
If your installation is successful, by running composer on command prompt, you will see all kinds of info just by running that command.
If you can see it, that means your Composer installation is complete. Let’s move to the next one.
Make sure that your htppd.conf includes httpd-vhosts.conf
Now let’s make sure that your htppd.conf also includes httpd-vhosts.conf. This is beneficial if you want to make a pretty URL just like this one:
Instead of writing up localhost/mylaravel, it would be “nicer” to have that pretty URL, right?
Anyway, let’s go on.
Go to C:\wamp\bin\apache\Apache2.4.4\conf and then open up httpd.conf.
After that, search for httpd-vhosts.conf and make sure that there is no ‘#’ (pound sign) in front of it. Save. After that restart Wamp just to be safe.
Now let’s begin the fun part: installing Laravel.
Install Laravel in specified folder
You usually want to install your Laravel in your www folder. (Obviously!)
So open up your command prompt, and then change directory to your WWW folder inside your wamp. For me it will be: C:\wamp\www
To change directory, just type cd c:\wamp\www
Basically you are changing folder to your www folder.
And then, you can install Laravel. Just use this in your command prompt:
composer create-project laravel/laravel your-project-name –prefer-dist
And then hit enter.
Just wait a while until it is finished downloading and installing.
Enable Laravel installer
If you want to use Laravel Installer, you have to run this command in your command prompt first:
composer global require "laravel/installer"
Wait until… everything finished.
Create Virtual Host
Now let’s create your pretty URL. You have to go to C:\wamp\bin\apache\Apache2.4.4\conf\extra and then open up httpd-vhosts.conf.
After that, you just need to paste the following and change your laravel folder to appropriate ones.
<VirtualHost *:80>
DocumentRoot “c:/wamp/www/mylaravel/public”
ServerName laravel.dev
</VirtualHost>
In my case, I used mylaravel for my laravel installation. You have to change it to something else. For server name, you can change it to whatever you want. In my case, I am using laravel.dev. (You don’t want to use google.com because if you do, you won’t be able to open up Google).
Obviously, you have to save and then restart your WAMP again.
Update Windows Hosts file
After you have changed your virtual host, you need to change your host file.
Go to C:\Windows\System32\drivers\etc and copy hosts and paste it on your Desktop. And click on the host file you have pasted on your Desktop. Open that up using Notepad.
Put this in that host file:
127.0.0.1 laravel.dev
Change laravel.dev into what you already decided in your virtual host file. For me, mine will be laravel.dev.
Copy the one that you modified just now and put it back into your C:\Windows\System32\drivers\etc folder.
You’re done!
Modified from this source: http://copygrammer.com/how-to-install-laravel-on-windows/ (my blog)
Installing Laravel framework on window via Laravel installer:
make sure you have composer on your computer.
download the Laravel installer using Composer by typing following code in the command prompt:
composer global require "laravel/installer=~1.1"
go to folder:
C:\Users\ {User Name} \AppData\Roaming\Composer\vendor
copy the vendor folder and paste it into the folder (Destination folder) where you want to install Laravel project; for example, in folder D:\Test\Laravel.
after pasting, your folder structure look like this:
D:\Test\Laravel\vendor
pressing down on Shift key and Right click on the folder vendor in your destination folder (D:\Test\Laravel\vendor), and choose "open command window here".
enter the command below:
laravel new your_project_destination
after the command runs, you will see laravel folder in your_project_destination
You can install laravel using Homestead box.
There are a few steps you need to follow.
Make sure that you have windows virtualization turned ON in your BIOS. This will save you a few hours if you are installing it for the first time.
You will also need to install Vagrant and Virtual Box before starting the installation of Homestead.
The main advantages of using Homestead is that it provides a Linux virtual machine where you can easily install packages. It does comes with a lot of packages installed.
http://deepdivetuts.com/installing-laravel-5-4-on-windows-machine-using-homestead
If you have not installed composer on your system get from here.
You will get this if you have composer on your system installed
Installing Laravel
Step 1: Installing Laravel globally.
Open cmd in Windows and enter this command.
composer global require "laravel/installer"
This will download the latest version.
Check by entering the below command.
Step 2: Creating a new Laravel Project
Run the below command in cmd, blog is the name of my new project.
laravel new projectname
That's it. Now you have your new project folder in the directory you have saved.

Laravel 4 Installation Problems on WAMP/Windows

First,I use wamp on my Window7.I open php-openssl,and I git pull the laravel from github.com,and then I put laravel on my d:/wamp/www/, I change the c:/windows/system32.But when I open the url
http://localhost/laravel/public
I see this question.
I am a newbie on laravel,and without install on Ubuntu.Where is my wrong, without no pear,or something else? Thank you!
You need to run composer install in a command prompt.
If you do not have composer, download the phar file from their website.
Place the file you just downloaded into the laravel directory.
Then, make sure that the absolute path to php.exe is added to your PATH environment variable.
Then, you can hold down shift, and right click anywhere inside the laravel directory, and open up a command prompt window. Then, run php composer.phar install. The process may take some time, depending on the speed of your internet connection.
Instead of using the above method, you can download the Composer installer for Windows, install it, and just run composer install.
Note that you only need to do this in order to put the Laravel components together. You do not need to run it on a live server.
Please consult the Laravel Docs for installation and other instructions: http://laravel.com/docs
Try This :
Installing Laravel 4 on WAMP
1. Enable OpenSSL
OpenSSL must be enabled in the PHP configuration.
Edit php.ini in your WAMP’s PHP folder, e.g.:
C:\wamp\bin\php\php5.4.12\
Note: This is not the php.ini in C:\wamp\bin\apache\Apache2.4.4\bin.
Find the following line and remove the semicolon save it:
;extension=php_openssl.dll changed to extension=php_openssl.dll
2. Install Composer
(i).Download the Composer Windows installer from getcomposer.org.
(ii). Run the installer.
(iii). When it asks for the location of php.exe, point it to the executable in your WAMP’s PHP folder, e.g.:
C:\wamp\bin\php\php5.4.12\
(iv). Finish the installation.
(v). Open a command-line interface (cmd) and type:
composer
It should return a list of options. If you get an error, restart your computer and try again.
Composer has now been installed and added to your PATH environment variable. This means you can run it from any directory using the command-line interface.
Now we need to install Composer. This is a dependency manager that will download the latest release of Laravel and specific versions of Laravel’s dependencies, such as Doctrine and Symfony.
3.Install Laravel
Now that Composer has been installed, Composer can download and install Laravel onto your system.
(i). Open a command-line interface (cmd).
(ii). Go to the directory in which you want to install Laravel. This is usually your development directory. In this tutorial, we’ll use C:\wamp\www\laravel
(iii). Instruct Composer to install Laravel into a project directory. we use project name myproject.
composer create-project laravel/laravel myproject --prefer-dist
Note: This will install Laravel in a subdirectory myproject of the current working directory.
Three type of installation to be completed
Now your project was running directory like
C:\wamp\www\laravel\myproject\public\
After completed put tick mark and increase the point....
Do php composer.phar dump-autoload or php artisan dump-autoload

Resources