2
I’m trying to use PHP through the terminal, but I can’t, when I type which php
he returns /usr/bin/php
so I can’t run PHP files, because it can’t find the files.
I am using XAMPP for MAC
2
I’m trying to use PHP through the terminal, but I can’t, when I type which php
he returns /usr/bin/php
so I can’t run PHP files, because it can’t find the files.
I am using XAMPP for MAC
4
At the root of your user folder, ~
, has a file called .bash_profile
. Add the following at the end of it:
export PATH="/applications/XAMPP/xamppfiles/bin:$PATH"
Save the file and restart the terminal. Now the which php
should indicate php-cli of XAMPP.
Alternative #1
To call an executable from a specific directory, just type in the full path to it. Instead of
php meuscript.php
wear like this:
/Applications/XAMPP/xamppfiles/bin/php meuscript.php
Alternative #2
Navigating to the folder where is the PHP of XAMPP, and running from there:
cd /Applications/XAMPP/xamppfiles/bin
php meuarquivo.php
Browser other questions tagged php osx xampp
You are not signed in. Login or sign up in order to post.
how do I meet and add? I’m not familiar
– Elaine
which code editor you use?
– bfavaretto
I use the Brackets
– Elaine
In Brackets, type +O, navigate to your user folder (the one with your name in the left bar), and choose the file
.bash_profile
. If it doesn’t exist there, create one with that name.– bfavaretto
An extra question, I include several files in my
meuarquivo.php (require)
when access it on the web runs normally but when it is through the terminal it does not find the files... this has logic?– Elaine
You’d better ask a separate question about that, @Elaine. It might have to do with PHP configuration.
– bfavaretto