error upgrading php in mac - php

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!

Related

Configure CLI interpreter for PhpStorm on Mac

I have installed PHP from brew and it works just fine in VSCode, but in PhpStorm I am not able to configure the interpreter in order to debug my PHP code.
In the configuration file, it says "PHP not installed" with a red icon, and the executable path is empty.
I am trying to debug just code, not a web page, so there is no need of Apache Server or other for now.
When executing php -v on terminal, I get:
PHP 8.0.17 (cli) (built: Apr 5 2022 22:43:04) ( NTS ) Copyright (c)
The PHP Group Zend Engine v4.0.17, Copyright (c) Zend Technologies
with Zend OPcache v8.0.17, Copyright (c), by Zend Technologies
which tells me that this installed correctly.
As per PhpStorm documentation you have to point to PHP executable there (which means: provide the full path). Just having php may not be enough.
Open your OS terminal and type which php (or it could be where php; this depends on the OS used). It will show the full path to the executable that gets executed when you run php in that terminal.
If you have more than one PHP version installed and want to use non-default PHP installation/version then use the path for that specific version.
Copy that full path from there (if there are more than one path then use the top most or the most desired one) and use it in the "PHP executable" field of the PHP Interpreters screen in PhpStorm.

Failing to load Xdebug when running PHPUnit Tests

I have been having a option for a few days. When I try to run a PHPUnit test I get a message saying failed to load Xdebug. I have tried to reinstall, change filepaths etc but I am getting nowhere. Hoping somebody can help me out :)
PHP 7.4.3 (cli) (built: Oct 6 2020 15:47:56) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies
Failing loading xxxx.dll is an indication that PHP can't load the extension file. This could have several reasons:
The file does not exist → check if it does
The permissions on the file are incorrect → check the permissions
The file is of "the wrong extension type". Which can be either:
the extension is for the wrong wrong PHP version
the extension is of the wrong bitness (32 vs 64bit)
the wrong TS variant (NTS vs ZTS)
the wrong "debug mode" build of PHP (either debug, or nodebug)
The API type (except for bitness, which you can check with echo PHP_INT_SIZE;; 4 is 32bit, and 8 is 64bit) is reflected in the "Zend Extension Build" output in php -i or phpinfo().
You can use Xdebug's wizard to tell you which exact file to download for your specific set-up.

ionCube Loader on Windows 64-bit running PHP 5.6.8 not working

I have tried to configure ionCube Encoder on my Windows 10 PC running PHP 5.6.8 but without success. After downloading the encoder zip file from ioCube Loaders
I copied the "ioncube_loader_win_5.6.dll" to "C:\xampp\php\ext". Then I updated my php.ini file to loaded the encoder
[ionCube Loader]
zend_extension="C:\xampp\php\ext\ioncube_loader_win_5.6.dll"
and restarted apache, but when I test it from then command prompt using "php -v", it does not load. See my result
php -v
Failed loading C:\xampp\php\ext\ioncube_loader_win_5.6.dll
PHP 5.6.8 (cli) (built: Apr 15 2015 15:07:09)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
I also tried setting it up using the loader-wizard, but it did not work too. Anyone with useful information will be of great help right now.
Thanks
This Post is old but it might help other people. You have just to replace to dll. I had the same problem when using the 64bits dll. Replacing it with the x86 dll did the tric

Two php version on mac, can i fix it?

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?

Mongo driver cannot shown in phpinfo()

# 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 :)

Categories