Error to use terminal commands on PHP with Mac OS MAMP - php

I'm using MAMP 6.5 - Build 33813 (Macbook Air M1 2020) to make some Apache hosts.
All everything is ok, except one thing. I can't use terminal commands on my PHP code (exec, copy, and others).
I uninstalled my Brew PHP and using only MAMP PHP 7.2 and 8.0 (CGI).
I receive no errors or logs, just doesn't work. This is my terminal's response when I run php -v:
PHP 7.2.34 (cli) (built: Aug 5 2021 15:20:02) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
Image - PHP MAMP Config

Related

Make MacPorts PHP 7.3 run on OSX Mojave

I am struggling with linking the newly installed PHP version on macOS Mojave (10.14.6)
I've installed PHP 7.3 via MacPorts (I need that exact version right now, I might update it later). Installation went alright, no errors.
When I run php -v it gives me
PHP 7.1.33 (cli) (built: Jan 26 2020 22:52:32) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
which, I suppose, is the version shipped with the OS.
My .bash_profile looks like this
PATH=/usr/bin:/bin:/sbin:/opt/bin
PATH=/usr/local/sbin:"$PATH"
PATH=/usr/local/bin:/usr/sbin:"$PATH"
PATH=/opt/local/bin:/opt/local/sbin:"$PATH"
export PATH
export PATH=${PATH}:/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
When I run php73 -v it logs
PHP 7.3.33 (cli) (built: Feb 16 2023 20:14:16) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.33, Copyright (c) 1998-2018 Zend Technologies
MacPorts has installed the PHP 7.3 into /opt/local/bin.
So obviously, the php version in use by the OS doesn't know about PHP 7.3
Oh, and using homebrew is not really an option. I've just lost hours trying it to install php 8.2 and it failed with one lib or another, constantly claiming that my XCode command line tools are outdated (duh! – and I am not upgrading those as it would require updating the OS to the latest version which would in turn strain my MBP even further).
Any help is greatly appreciated.

Update kuduscript with php 8

We are trying to update our azure web app service to php 8.
In deployment we use kudu and app service build service.
When we try to deploy after changing to php 8 in the code we get the error that php command is not found.
And when we run compose installer we can install due to composer.lock requiering php 8.0
The only source for php 7.3 (which specifies that is the problem) is the kudu script. However we have not found a decent way of updating this to php 8. Has anyone done this?
kudu_ssh_user#:/$ php --version
PHP 7.3.27 (cli) (built: Mar 18 2021 08:28:09) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.27, Copyright (c) 1998-2018 Zend Technologies

PHP version Conflict between 5.5 and 7.1 in ubuntu 14.04 LTS

When I want to know my php version by terminal using
#php -v
I am getting
PHP 7.1.4-1+deb.sury.org~trusty+1 (cli) (built: Apr 11 2017 22:45:20) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.1.4-1+deb.sury.org~trusty+1,
Copyright (c) 1999-2017, by Zend Technologies
But when I am trying to run info.php written with php code
<?php phpinfo(); ?>
O/P
PHP Version 5.5.9-1ubuntu4.21
Please let me clear what is happening exactly with my php version.
I installed the full LAMP on my system freshly after un-install APACHE2, PHP & My-Sql.
Also, I recommend check Loaded Configuration File item at phpinfo() output.
Here I got /etc/php/7.0/apache2/php.ini using Ubuntu 16.04 LTS and PHP 7.0.15 with Apache.
Then at the terminal, run php --ini and check the same item Loaded Configuration File: to see if got any difference.

2 versions of PHP installed Mac OS X causing xdebug fail

Mac OS X 10.8.5. I am trying to get Netbeans running using xdebug. To date I have tried XAMPP and MAMP without success. Apparently there is a native PHP on the Mac that I can't figure out how to remove:
sh-3.2# which php
/usr/bin/php
sh-3.2# php -v
PHP 5.3.26 (cli) (built: Jul 7 2013 19:05:08)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
However, the PHP in my MAMP installation shows:
sh-3.2# pwd
/Applications/MAMP/bin/php/php5.5.3/bin
sh-3.2# ./php -v
PHP 5.5.3 (cli) (built: Sep 18 2013 14:31:13)
I followed the instructions on this page:
https://netbeans.org/kb/docs/php/configure-php-environment-mac-os.html
but xdebug does not show up in the list of extensions on the phpinfo page. I downloaded the latest xdebug by the way (2.2.3). I've also tried the tailored instructions here: http://xdebug.org/wizard.php with no luck.
I'm certain it's because if the mismatched php's. How do I remove the native PHP to get this working?
Thanks!
Roberto

PHP version mismatching

I started a Amazon EC2 instance using Elastic Beanstalk. It came with PHP 5.3 but I needed 5.2.
I downgraded the version and restarted apache. If I type "php -v" I see
PHP 5.2.17 (cli) (built: Oct 17 2013 16:24:38)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
But if I execute phphinfo() on the server it returns : PHP Version 5.3.27
The server is Apache httpd
Any help?

Categories