I've formatted my computer, install Homebrew and run brew install php && brew upgrade php, and after check my php version with php -v shows me 7.4 that's correct. But when I run phpinfo() in localhost, shows me php version is 7.1.
I have put paths to .bash_profile file like that
export PATH=/usr/local/Cellar/php/7.4.5_1/bin:$PATH
export PATH=/usr/local/Cellar/php/7.4.5_1/sbin:$PATH
php -v is true, php-fpm -v is true but apache shows me PHP Version 7.1.23
How can I fix this?
Related
Using the commmand php -v on a Ubuntu 18.04 server is displaying PHP version 8.1.14, but no PHP8.* module is installed.
I have tried running the command: sudo update-alternatives --config php which displays:
Available PHP versions
Disabling the PHP8.1 module will show me that the module is not installed:
module not installed
While php -v is really showing me PHP8.1:
PHP version
I have tried to purge the PHP 8 version with the following command:
sudo apt-get purge php8.*
It showed me 0 modules were marked for removal, just to be sure I also ran autoremove & autoclean commands.
When I display the PHP info, it also shows the 8.1 version:
PHP info
I need to get the server back to version 7.4 to make some installations function properly, I have tried all options above but did not succeed. How can I downgrade to PHP Version 7.4?
While I was installing the PHP Selector add-on for DirectAdmin, I noticed Zend modules were being installed for 7.4. Perhaps these were missing for the server to switch back to version 7.4. Problem solved!
My php version is PHP 7.4.1.
But with MAMP, the highest possible php version I can use is 7.3.8.
So, when I try to open my webpage, I get the error message:
Fatal Error: composer.lock was created for PHP version 7.4 or higher
but the current PHP version is 7.3.8.
How can I downgrade my php version to fit to my MAMP version?
I tried:
brew install php#7.3
It was installed, but when I now write php --version, I get the error:
-bash: /usr/local/bin/php: No such file or directory
you don't need brew's PHP if you want to use MAMP's PHP.
just use Applications/MAMP/bin/php7.3.8/bin/php --version to use MAMP PHP, if you want to use as default command line, just link it to /usr/bin.
to link it run this to your command line:
export MAMP_PHP=/Applications/MAMP/bin/php/php7.3.8/bin
export PATH="$MAMP_PHP:$PATH"
or
PHP_VERSION=`command ls /Applications/MAMP/bin/php/ | sort -n | tail -1`
export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH
check it out for more detail.
PS: Maybe you should delete your brew php to do it.
First
$ brew update
and
$ brew upgrade php
I have been trying to enable PHP 7.1 iMap extension on MAC Mojave 10.14.5, but I haven't had any luck getting it to work. Any help will be greatly appreciated.
Before any installation, php -v returns 7.1.23 and which php returns /usr/bin/php since Mojave has PHP 7.1 preinstalled. However, php -m doesn't include iMap since the extension is not installed by default.
I have tried to tap with either kabel/php-ext or
v1shky/php-ext and brew install php#7.1-imap, got the following in the installation process:
The php.ini and php-fpm.ini file can be found in:
/usr/local/etc/php/7.1/
php#7.1 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.
If you need to have php#7.1 first in your PATH run:
echo 'export PATH="/usr/local/opt/php#7.1/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/php#7.1/sbin:$PATH"' >> ~/.bash_profile
For compilers to find php#7.1 you may need to set:
export LDFLAGS="-L/usr/local/opt/php#7.1/lib"
export CPPFLAGS="-I/usr/local/opt/php#7.1/include"**
And when I check, php -v returns 7.1.30, which php returns /usr/local/bin/php and php -m still doesn't include iMap.
Then I followed the instruction to modify bash_profile, and now php -v returns 7.1.30 and which php returns /usr/local/opt/php#7.1/bin/php. However, php -m still doesn't include iMap.
Is there a better way to add the iMap extension for the existing PHP 7.1 that comes with Mojave? If not, is there anything else I should do when using HomeBrew so that it would work?
By the way, I have to stay on PHP 7.1 instead of upgrading to 7.2 or 7.3 due to some other frameworks we are using.
Thanks in advance!
I just successfully upgraded my server php version from 5.3 to 5.6
When I run:
php -v
I get:
PHP 5.6.40 (cli)
But when I create a file write
echo phpInfo();
The php version showing is 5.3.3
How do I set the php version on phpinfo() to show 5.6
Thanks,
Try this..
rm /usr/bin/php
ln -s /usr/bin/php56 /usr/bin/php
service httpd restart
And then run
php -v
I have struggled to make Apache recognize Php 5.3.29 (I need it to run a very old Drupal 6 website).
I am using a Google Cloud Platform VM running Ubuntu 14.04 LTS.
I successfully installed PHP 5.3.29 by compiling it and now running
# php -v
shows The correct version PHP 5.3.29. However after installing Apache I couldn't get it to recognize that version of PHP, it couldn't even compile PHP.
So I read somewhere that I need to run
sudo apt-get install libapache2-mod-php5
But when i do that and run an info.php file with
<?php
phpinfo()
?>
I get PHP Version 5.5.12-2ubuntu4.4
My question is: How can I make it so Apache will point/recognize The older PHP version 5.3.29 ?
When you compile php from tarball
./configure \
--with-apxs2=/usr/bin/apxs2 //path to your apxs2 file
//... more config options
make
make test
make install
After that simple resatart apache