I use PHPStorm on OSX with PHPUnit and Laravel.
When I go inside my project from the PHPStorm console and type:
$ php --version
PHP 5.5.29 (cli) (built: Sep 9 2015 00:26:40)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
$ which php
/usr/bin/php
From my terminal:
$ php --version
PHP 5.6.16 (cli) (built: Nov 27 2015 21:37:15)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans
$ which php
/usr/local/php5/bin/php
The above I installed. I have edited my PATH to use it.
Now I want to change the PHP version inside my PHPStorm.
I tried editing composer.json:
"require": {
"php": ">=5.6.16",
and then running update:
$ composer update
Your requirements could not be resolved to an installable set of packages.
Problem 1
- This package requires php >=5.6.16 but your PHP version (5.5.29) does not satisfy that requirement.
I also tried to create a symbolic link .
$ sudo ln -s /usr/local/php5/bin/php /usr/bin/php
It fails with:
ln: /usr/bin/php: Operation not permitted
I am not sure what to do. I would like to update Php to 5.6.16.
It appears you have at least two versions of Php installed.
Try changing the interpreter path within PhpStorm.
File->settings->languages & frameworks->interpreter ...
Related
Whenever I try to test PHPUnit or composer update, I get this error:
PHP Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.4.0". You are running 7.3.19
but when I put on the terminal: source ~/.bash_profile it reads that I have 7.4 on my local machine and all works OK. Is there any solution for that issue, to not need to put every time that command source ~/.bash_profile before every start of the console?
Before run source ~/.bash_profile:
PHP 7.3.19 (cli) (built: Jun 12 2020 00:29:59) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.19, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.19, Copyright (c) 1999-2018, by Zend Technologies
After run source ~/.bash_profile:
PHP 7.4.13 (cli) (built: Nov 30 2020 14:57:43) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.13, Copyright (c), by Zend Technologies
I was facing the same issue, I was using command prompt for laravel artisan commands. Which was showing wrong php version. I closed it and from Xampp Control Pannel Open the Shell for artisan commands and now its detecting the correct PHP Version. It fixed my problem.
I downloaded & installed xampp-linux-x64-7.4.6-0-installer.run on my VM using terminal. Everything went right except PHP version.
The terminal output
php -v
PHP 7.2.24-0ubuntu0.18.04.4 (cli) (built: Apr 8 2020 15:45:57) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.24-0ubuntu0.18.04.4, Copyright (c) 1999-2018, by Zend Technologies
but php info shows version 7.4.6
is there any way to upgrade php version ??
you should be able to use this comand to set the default php version:
sudo update-alternatives --config php
I have two versions of PHP in opt/remi folder php56 and php72
but when I php -v on cmd it shows:
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
with Xdebug v2.4.1, Copyright (c) 2002-2016, by Derick Rethans
How to set default version to PHP 7.2?
I have two versions of PHP in opt/remi folder php56 and php72
how to set default version to PHP 7.2
SCL are designed for parallel installation so don't alter default version in base system
Once the collection is enabled, the version will be used
$ scl enable php72 bash
$ php -v
PHP 7.2.8 (cli) (built: Jul 17 2018 05:35:43) ( NTS )
If you want 7.2 to be the default version (base system) you should install it, according to Wizard instructions for "Default / single version" (and keep 5.6 as secondary version)
Change php cli version in Centos 7
First, find your php7, run phpinfo() and get path or you can do with other ways. for me, it is:
/usr/local/lsws/lsphp73/
then:
cd ~
. ~/.bash_profile
And:
alias php='/usr/local/lsws/lsphp73/bin/php'
Now:
php -v
PHP 7.3.13 (cli) (built: Dec 20 2019 16:02:35) ( NTS )
Create a file "/etc/profile.d/php.sh". Use pathmunge to add the path to your php bin you want as default on line one and save the file.
Example:
pathmunge /opt/remi/php73/root/bin
Reload your profile afterwards by logging in again.
Now if you do a which php and php -v you should see the following output in my case
[root#host etc]# which php
/opt/remi/php73/root/bin/php
[root#host etc]# php -v
PHP 7.3.4 (cli) (built: Apr 2 2019 13:48:50) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.4, Copyright (c) 1998-2018 Zend Technologies
with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v10.3.4, Copyright (c) 2002-2019, by ionCube Ltd.
This is the preferred way to accomplish this task using tools that are already supplied on a minimal install. This also allows scripts and commands to hit the correct php binaries when accomplishing other tasks. Commands like, pear, pecl, phar, php-config. You want your experience to be global when setting the default, otherwise you might wind up still getting version 5.6's tools when trying to install an extension or complete another task.
module enable php74
for your understanding:
cat /opt/remi/php74/enable
export PATH=/opt/remi/php74/root/usr/bin:/opt/remi/php74/root/usr/sbin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/opt/remi/php74/root/usr/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export MANPATH=/opt/remi/php74/root/usr/share/man:${MANPATH}
Don't work composer in PHP 7.0
I insert this command to the terminal:
$sudo composer require cocur/slugify
In the directory is created only one empty file composer.json
My OS:
Ubuntu 14.04
My PHP:
PHP 7.0.1-5+deb.sury.org~trusty+1 (cli) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
with Xdebug v2.4.0RC2, Copyright (c) 2002-2015, by Derick Rethans
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
Sorry, the application php7.0 has stopped unexpectedly
php7.0 crashed with sigsegv in xdebug_var_export
To get rid of the error, you might simply disable the Zend Extension "xdebug" for Composer runs:
;zend_extension = "/path/to/xdebug.so" in php.ini.
Hi I have configured php from source package and its install in /usr/local/bin/php the version was 5.2 but I have upgraded the PHP using yum repository to 5.4 which is installed in /usr/bin/php
whenever I type
root#server1:- which php
/usr/local/bin/php
showing this path and version is
root#server1:- php -v
PHP 5.2.6 (cli) (built: Oct 9 2013 07:08:43)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
and when type
root#server1;- /usr/bin/php -v
PHP 5.4.22 (cli) (built: Nov 18 2013 13:25:28)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
with Zend Guard Loader v3.3, Copyright (c) 1998-2013, by Zend Technologies
how do i set a default path of php to 5.4 version no need to use full path while using php
please help me
Setup a bash alias in your .bash_profile:
alias php="/usr/bin/php"