I used Homebrew to install php. When I use php -v I get 8.2.1. When I use brew uninstall php#8.2.1 I get the response
No available formula with the name php#8.2.1. Did you mean php#8.1?
How do I get php 8.2.1 uninstalled from my mac?
Related
sorry if there is a duplicate question for this but I'm trying to set this up for hours now and it just doesn't work.
I have a Debian 11 server with "KeyHelp" installed on it (little brother of plesk). It comes with PHP 7.4 but provides a simple Dashboard where you can install other PHP versions. I installed PHP 8.1 and tried to install the mongodb extension via PECL.
After "pecl install mongodb" I added "extension=mongodb.so" and after that didn't show up the extension on the phpinfo page, I double checked if the extension is really in the extension folder of php, where it was.
Turns out that I installed the extension for PHP 7.4 and not for PHP 8.1. Finally I tried to force PECL to install it for PHP 8.1 but it says "phpize8.1 command not found". I found no way to install phpize8.1, can somebody help me out with that?
Thanks in advance!
I am using Ubuntu 20.04
I have PHP 8.1 version. You have to install modules of PHP
sudo apt install php8.1-mongodb
List the modules
php -m
It's not exactly Debian. I hope it helps you.
If you run command:
sudo apt install php-dev
System will install automatically the correct version of php{x}-dev for your distribution, and all it's dependencies, included PECL.
another way is try to run:
/usr/bin/phpize
If this command works, you need to add phpize to your PATH:
PATH=$PATH\:/usr/bin; export PATH
In this way phpize will work in future.
i've updated my mac os to Monterey (12) and then I can not use composer command or php command and get this error
env: php: No such file or directory
macOS 12 (Monterey) removes the system provided PHP and you will need to install it yourself.
It is easy to install if you have brew installed. Simply run the following:
brew install php#7.4 brew-php-switcher
brew link php#7.4
This will install the latest version of PHP 7.4 as well as a handy utility for switching between PHP versions if you need to.
PHP has been removed from MacOS since v12 (Monterey), so you first need to install it on your own to use it. From my POV, the easiest way to do this is using Homebrew
run brew install php , it will take php last version, then you will be be able to use php on your mac
I've followed this guide to install Homebrew on an M1 based Mac.
After that I ran
brew install php#7.4
which installed PHP successfully.
If I now run
brew upgrade php
I get
Error: php not installed
What I like to achieve is to update the PHP that comes shipped with macOS, which is 7.3.22 when I run php -v.
How can I update PHP using Homebrew? I understood that I need to put something in my PATH to point to the newer PHP version? Given this is a new machine I actually don't have a .bash_profile file, only a .zshrc (I'm using ZSH, I assume that this file will be used and that I don't need a .bash_profile?)
It's not advisable to upgrade the system-provided PHP, but it's also not necessary.
brew link can be used to decide which PHP is utilized. brew link php#7.4 should do the trick; this can be also used to switch PHP versions around, i.e. brew link php#8.0 will switch you over to that while leaving both versions installed and available directly.
I have installed MongoDB PHP lib
but despite this I can't connect to MongoDB database
Error of rockmonogo :
To make things right, you must install php_mongo module. Here for installation documents on PHP.net.
Error of phpmoadmin :
PHP cannot access MongoDB, you need to install the Mongo extension for PHP.
Error of Laravel with Jenssegers\Mongodb lib :
Unsupported driver [mongodb]
Make sure that it is in fact properly installed. The errors you're getting seem to indicate that your environment can't find the extension. I've compiled installation instructions for you.
Unix-like Systems
Open a terminal emulator and run wget http://pear.php.net/go-pear.phar
Then start the installation of PECL with php go-pear.phar
Install the PHP MongoDB extension sudo pecl install mongodb.
Add extension=mongodb.so to the php.ini file.
Mac OS X
Install homebrew by running /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" in a terminal.
Run brew update
Run brew tap homebrew/php
Install the extension according to your PHP version.
PHP 5.4: brew install php54-mongodb
PHP 5.5: brew install php55-mongodb
PHP 5.6: brew install php56-mongodb
PHP 7.0: brew install php70-mongodb
Windows
Open your web browser to http://pecl.php.net/package/mongodb
Open the latest version from the DLL link (with the Windows icon).
Choose the appropriate version from the DLL list. They are sorted by PHP version, system architecture (i.e. 32-bit vs 64-bit), and thread safety.
Extract the downloaded archive and place php_mongodb.dll in your PHP extensions directory.
Add extension=php_mongodb.dll to the php.ini file.
For mac system, the homebrew php tap mechanism is deprecated and it won't work. You need to manually install it or you need to install Ampps which contains all the packages in built.
The following error might be thrown for the user with new version of the system
Error: homebrew/php was deprecated. This tap is now empty as all its formulae were migrated.
I have been wanting to upgrade php5 to php7 on my macbook but i just don't know how. I tried using homebrew and a couple other methods I found online but I just don't know how to complete it.
As a result php5 has been deleted from /usr/local.
How can i get php5 back and then how do i upgrade it to php7?
I want the newest version because I have a minecraft server that I run on my computer that used to use php5 but now requires php7. I have the latest macbook with the latest os.
As you are using homebrew, you can go with homebrew-php. You can install multiple version of PHP with this, and easily switch the version if you want
Or, you can use homebrew with php as usual
brew tap josegonzalez/php
brew tap homebrew/dupes
brew install php55
If you want to upgrade to PHP 7 but still keep current PHP 5, you should unlink PHP 5 first
brew unlink php55
brew install php70
Then you can use PHP 7.
And if you want to switch back to PHP 5, just unlink PHP 7 and link PHP 5
brew unlink php70
brew link php55