# php -m | grep mongo
mongo
# php -v
PHP 5.4.7 (cli) (built: Sep 8 2013 20:19:53)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
Any idea? Thanks
PHP mongo driver version is 1.2.12
You can follow the steps in the below link
Installing Mongi Driver for PHP
Also Looks like you are having trouble in loading the driver by adding the line
extension=mongo.so
to php configuration
To do that you need to first locate your php.ini files , normally there will be two files one for command line and one for apache .
Off course you can find it in phpinfo() . If you could not find it then
To know the locations of php configuration
Just run below command
php --ini
This command lists all configuration files which are some times not visible in phpinfo()
Hope this helps
NOTE : - I assume that you are using Linux or Unix environment and not windows . I did this guess by looking at the grep command which you have posted in your code :)
Related
I have to run composer in cpanel terminal to install and host laravel project. But however, it gives this error This package requires php ^7.2.5 but your PHP version (5.6.40) does not satisfy that requirement.
I go Settings >> MultiPHP Manager and select my domain and upgrade PHP version to 7.3
I check my PHP version in ~
[myuser#server ~]$ php -v
PHP 5.6.40 (cli) (built: May 5 2020 19:25:18)
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
I go to public_html/www (where my laravel project is placed)
[myuser#server www]$ php -v
PHP 7.3.18 (cli) (built: May 21 2020 03:33:34) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.18, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.18, Copyright (c) 1999-2018, by Zend Technologies
I go to server_information under General Information and the PHP version is 5.6,
so my question is
How to upgrade server PHP version from 5.6 to 7.3
Please note that I don't have root access, and also ApacheEasy4 is also not accessible by my user in Server.
My MultiPHP Manager Image
if in "phpversion" function you see the version of php is 7.x, but in composer is 5.x: it's because your server manager has set default php path in its envirnoment variables to php5 folder. so you need to use "/php/version/php composer" instead of "php composer"
example:
/usr/bin/local/php/7.3/php composer update
for find the path of php binary file, you can use "php --ini" command to see where is "php.ini" location. when you execute this command it tell you the ini configuration file (php.ini) path. actually in the parent of your ini file location is a direction with bin name that its your php binary file location. for example in my server output "php --ini" is:
Configuration File (php.ini) Path: /usr/local/php72/lib
Loaded Configuration File: /usr/local/php72/lib/php.ini
Scan for additional .ini files in: /usr/local/php72/lib/php.conf.d
Additional .ini files parsed: /usr/local/php72/lib/php.conf.d/10-directadmin.ini,
/usr/local/php72/lib/php.conf.d/50-webapps.ini
so is my configuration file (php.ini) path:
/usr/local/php72/lib
and my php binary file is:
/usr/local/php72/bin
and my needed command is:
/usr/local/php72/bin/php composer update
Note: please pay attention don't use "which php". because its show you the global envirnoment value of php path that in your case it has set on php 5.x so you need to call binary file from php 7.x folder. and for do it, you should follow my guide to find your php 7.x binary file path
This command worked for me in CLOUDLINUX 7.9 and cPanel v94.0.4:
/opt/cpanel/ea-php73/root/usr/bin/php /opt/cpanel/composer/bin/composer update
Click on manage on the right and update the server version.
Hello I having trouble to to install "jenssegers/mongodb": "^3.2" on my local environment.
i have this error:
I have added to my /etc/php.ini full path to extentions="/usr/lib/php/extensions/no-debug-non-zts-20160303/mongodb.so"
restart the php and apache
I have try to find mongodb.ini, fail on that.
I try all the tutorial is google... still no luck
Can any one help me please?
PHP 7.1.23 (cli) (built: Feb 22 2019 22:08:13) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
It seems that you forgot to install MongoDB PHP Driver itself.
To do that just install it with pecl:
sudo pecl install mongodb-1.5.3
1.5.3 is the last stable version, so I'd recommend to use it rather than the most recent 1.6.0alpha.
Then, don't forget to add it to your php.ini (run php --ini to see where it's located):
extension=mongodb.so
To test that it works just run:
php -m | grep mongo
If you see mongodb in output, then it works.
I am running OSX El Capitan (version 10.11.6).
I had php 5.5 installed.
Phpunit requires php5.6 and more so I tried to upgrade my php to 5.6. I couldn't do it so I gave php7 a try.
I followed these guides:
https://coolestguidesontheplanet.com/upgrade-php-on-osx/
https://php-osx.liip.ch/
Mac upgraded PHP to 5.6, but CLI php -v get 5.3.28?
My current output with php -v is :
PHP 7.0.12 (cli) (built: Nov 1 2016 10:21:11) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.12, Copyright (c) 1999-2016, by Zend Technologies
with Xdebug v2.4.1, Copyright (c) 2002-2016, by Derick Rethans
Funny thing, my output with a phpinfo(); when called from somewhere inside a Symfony project, is still PHP Version 5.5.36
Any ideas??
Terminal uses a different PHP than a HTTP server in browser. You can check what PHP you're using in CLI (command line interface) by this terminal command:
$ which php
I don't know if you use any AMP stack (like MAMP). They include their own PHP, so you need to update them in order to have a different PHP version in browser.
Maybe you can use this trick to determine what PHP versions you use in browser / CLI: Find the php.ini path in your phpinfo() output and compare it with this terminal command:
$ php -i | grep php.ini
It's always a good idea to use the debug URL to troubleshoot your Symfony projects; to use this, simply append:
app_dev.php
For example if your route was like http://myhome/, then you would use:
http://myhome/app_dev.php
Then on the bottom of your browser you will have the Symfony debug bar. In the bottom right corner, the version of Symofny is shown, an if you move your mouse over it, you will see the version of PHP; plus also a link to "View phpinfo()". You can click on it to view the full PHP information, including where the PHP file is located.
The PHP config file used (shown on the phpinfo() page) is shown by:
Loaded Configuration File
Hope that helps!
I have a configuration problem about my php installation on my mac os x 10.9.2
If i do
php --version
on my terminal i get following output:
PHP 5.3.27 (cli) (built: Dec 4 2013 06:25:36)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
while if i try to check php version via phpinfo(), i get following
PHP Version 5.4.24
so i have two php different version installed, 5.3.27 for cli mode e 5.4.24 on server side.
Also if i try to change configuration in php.ini, at path that i see on phpinfo() response (/private/etc/php.ini), after restart apache, i don't see nothing change; so i think that php.ini maybe is in another place.
How can i do to fix my php installation to have only one php version?
If you want it 5.4 on the CLI also, try moving the one at /opt/local/bin/php out of $PATH.
Normally php lives at /usr/bin/php, so it should find that one when you move the one at /opt/local/bin/php out of $PATH. Maybe echo $PATH shows /opt/local/bin/ before /usr/bin/ for you?
Lately i've been struggling with installing zend optimizer on my machine (since i needed that for irrelevant purposes), but i found out that it works best on php 5.1. So i get one from HERE and zend optimizer i had stored from my backup disk. Both tar.gz files. I installed php, so now php -v returns with:
PHP 5.1.4 (cgi) (built: Jun 10 2013 13:38:28)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
Which indicates that it works quite well. However, to install zend optimizer, i need to edit php.ini file, which is basically nowhere.
I tried looking for it with where is php.ini , got:
php: /usr/lib/php /usr/local/bin/php /usr/local/lib/php
but obviously in none of those i can find any.
then i tried
sudo find / -name "php.ini"
and got nothing.
I'm running Debian 7 Wheezy, with apache2, mysql 5.1 and php5.1 - any ideas?
Linux sklep 3.2.0-4-686-pae #1 SMP Debian 3.2.41-2+deb7u2 i686 GNU/Linux
I'll provide any needed information, to help you help me solve the problem.
Make a PHP script with phpinfo(); in it.
Run it, and it will show you where the .ini file is.