how to know the version of homestead installed - php

I can't remember what version was installed and I want to see know but I don't know how. Probably there will be some command to the terminal but I can't figure out.
Can anyone tell me?
Thanks in advance.

For newcomers to Laravel, this depends on what instance of Homestead you're working with (how you've chosen to install Homestead).
Per-project installation
# From your project directory, run this
php vendor/bin/homestead --version
Global installation
# If you've already set homestead in PATH env
homestead --version
# If you haven't
php ~/Homestead/homestead --version
Hope this saves you some minutes.

you can use -v or --version
homestead --version
Versions:
Vagrant: Run vagrant -v to show the version.
Provider: Virtualbox, VMWare or Parallels and it's version.
Homestead: Run homestead --version to show the version.

If you want to check the version of Homestead repository you can check using following command on ~/Homestead
$ git branch -v
and the result would be something like this
* master 09fce4c Tag v10.0.2
and here it is v10.0.2

Related

Composer uses wrong php version, but php -v shows the correct one (Ubuntu)

I'm trying to install my composer packages, but it gives me this:
This package requires php >=7.0.0 but your PHP version (5.5.9)
But php -v gives me this: PHP 7.0.22-0ubuntu0.16.04.1 (cli) ( NTS )
I am running an Ubuntu 16.04.3 LTS machine, I found some soultions for Mac and Windows, but nobody seems to have the issue on Linux?
try this:
composer install --ignore-platform-reqs
or this in composer.json
"config": {
"preferred-install": "dist",
"platform": {
"php": "7.0.0"
}
}
in the second solution basically you're faking a platform, and run composer.phar update after this
If you're using Debian based systems, you can ask it to globally use a specific version with the following command (depending on how and where your php versions are installed to):
sudo update-alternatives --set php /usr/bin/php7.2
update-alternatives creates, removes, maintains and displays
informations about the symbolic links comprising the Debian
alternatives system.
Try this it worked for me :
alias php='/usr/local/php7/bin/php'
php composer.phar install
composerreferences the PHP executable here as follow:
#!/usr/bin/env php
When I do which php I get /c/Program Files/php-7.1/php under GIT-Bash (Windows 10).
Under Linux (at home I have Debian), php may be a symbolic link to an actual PHP binary.
So do the following:
Double-check the said php with ls -l `which php`
Make sure that you only have one PHP version installed, this may cause mixing incompatible versions which may be the root cause of your problem
That should help you, finding the root cause.
Just sharing here because I had this same issue and found this thread first while searching.
For me I had a Windows server with PHP 5.6.? on it as well as PHP 7.2.? on it. I had configured IIS to use 7.2 but 5.6 was still in the environment variables under path. Open System Properties>Advanced tab> "Environment Variables...". Edit "path", and remove the reference to "C:/program files (x86)/PHP/v5.6" from path and save.
Restart your terminal and you should be set. Hope that helps someone.
I recently came across the same problem. php --version returned 7.4.30, but Composer said it was using PHP 8.0.18.
It turns out Composer is using its own PHP version. The composer script contains a hardcoded path to PHP 8. (To me, this is a composer bug, as Composer should respect the value of the config.platform.php property of the composer.json file.)
An option may be to alias composer:
alias composer='/usr/local/bin/php /usr/bin/composer.phar
Another option may be to rewrite composer:
cat /usr/bin/composer \
| sed 's~/usr/bin/php8~/usr/local/bin/php~g' \
> /usr/bin/composer.tmp
mv /usr/bin/composer.tmp /usr/bin/composer
This is how I found out. First, I wanted to find the location of composer. By using whereis composer, one can find the path of the composer command. For me, it returned
composer: /usr/bin/composer
I then wanted to see the contents of /usr/bin/composer, so I could find out what the composer command was doing under the hood. By using cat /usr/bin/composer, the contents of the composer script are printed. For me, it returned
#!/bin/sh
/usr/bin/php8 /usr/bin/composer.phar "$#"
There it is. The composer command uses hardcoded /usr/bin/php8 to execute the composer.phar file.
Well, this worked for me
$ alias composer="php /usr/bin/composer.phar"
$ composer install
Use the exact php binary in the alias, for example
$ alias composer="php8.1 /usr/bin/composer.phar"
None of above didnt worked for centos 7.
After this command composer php version fixed
The correct answer below
SSH Command:
scl enable ea-php74 'composer diagnose'

How to run composer on MAMP 's php version?

I can't run composer install because my php's version on my OS is not enough updated (5.5.36). So i tried to install composer globally with my MAMP's php(5.6.10)
1) I create alias for my MAMP's php
nano ~/.bash_profile
alias phpmamp='/Applications/MAMP/bin/php/php5.6.10/bin/php'
2) Run this line to install composer
curl -sS https://getcomposer.org/installer | phpmamp
3) Run this line to move composer
sudo mv composer.phar /usr/local/bin/composer
Composer is installed (run composer on terminal works)
This is a the tutorial.
But when i want to run composer install, composer uses my OS php.
Any idea ?
Those lines worked for me. I override the OS PHP path to my MAMP PHP path.
PHP_VERSION=`ls /Applications/MAMP/bin/php/ | sort -n | tail -1`
$ export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH
$ source ~/.bash_profile
You can check the version by running :
$ which php
The complete solution
Thanks to #Andrew Patton
This is an old question, but it came up in web search for a similar issue I was having, and the latest version of MAMP Pro (mine is 6.6.2) has a GUI solution:
In Languages > PHP, under 'Default version', you should see a checkbox for "Also activate shortcut for Composer".
What this did for me is add an alias of composer=/Applications/MAMP/bin/php/composer (in my zshell ~/.profile file on macOS Monterey). Maybe yours works similarly.
Of course, when switching PHP versions, it wouldn't also switch composer versions (which is necessary when switching between PHP 5 and 7.2.5+), so I have to use the OS install for one version and MAMP's for another. A little tricky, but if you don't have this problem, then the alias will be fine.

Installing FFMpeg in Lumen

I am using Lumen (of Laravel) as my backend and using vagrant. I am want to install and use FFmpeg but I got confused how to install it.
Do I need to install it on my localhost or add it to Lumen? or both?
I found this page but I got lost which commands to run.
Update: I installed this repo on Github and run it in vagrant. I think this installed the latest version on my local server, but what should I do next? How can I install and use FFMpeg with Lumen in php?
Go to your Homestead folder, run vagrant ssh. This will get you into your vagrant machine's terminal. Run command sudo apt-get install ffmpeg there and acknowledge the questions you get asked. (Additional libraries for PHP integration might be required.) FFMpeg will be ready to use.

Troubles with Homestead / Laravel installation (Mac)

I was following these instructions to install homestead on my Mac
http://pastebin.com/48PHSNC2
Homestead installed properly, but when it initialized, it didn't create a Homestead.yaml file. I have no idea how to reinitialize homestead or fix this. Reading through the installation guide Laravel gives you, it suggests using $ bash init.sh to create the .yaml file... unfortunately, this apparently doesn't exist for me either.
I used the composer command to install the CLI:
composer global require "laravel/homestead=~2.0"
Any ideas? I'm stumped...
I ran into a similar issue using Homestead 2.X (I dont care for Homestead 3 ATM).
basically do the following:
find the bash_init.sh file by running sudo find / -name init.sh
cd into the directory it's in, mine was in /Users/me/.composer/vendor/laravel/homestead/init.sh
make it executable, by running chmod +x init.sh
run ./init.sh
...
profit!
You can generate manually by clone git clone https://github.com/laravel/homestead.git Homestead. This will generate homestead.yaml file. Open and edit and change the parameters to fit your system configuration. For further reading
https://dev.to/ko31/installing-laravel-homestead-on-macos-5910

Laravel Homestead - older versions of PHP and Laravel

Is it possible to run homestead with an older version of PHP and Laravel 4.1? I need to set up my VM to replicate our production server, as closely as possible.
I find myself in 2021. According to the official docs and with the current Laravel homestead v10.17.0 you have the possibility to explicitly set the PHP version required right at the Homestead.yml file:
sites:
- map: homestead.test
to: /home/vagrant/project1/public
php: "7.1"
- map: project2.test
to: /home/vagrant/project2/public
php: "5.6"
- map: default.test
to: /home/vagrant/project1/public
Then, don't forget to apply the changes with
% vagrant provision
Moreover, you could change dynamically the PHP version used in your Laravel Homestead Ubuntu virtual machine
$ sudo update-alternatives --config PHP
$ php -i | grep "Loaded Configuration File"
$ php -v
But that only works for composer update, it doesn't seem to work for an application. So changing the Homestead.yml file is the way to go.
Homestead is just a prepackaged version of Vagrant with PHP5.6, ngnix, mySQL etc already installed and configurable.
If you need a specific environment that is "different" to Homestead, you just create your own Vagrant environment with a bashscript that installs the versions of software that closely matches your production environment.
This guide here provides specific information for Laravel - but any Vagrant guide will be able to help.

Categories