To begin, I am not using MAMP or any LAMP.
I have PHPStorm and I want to add my php installation as an interpreter. When I choose the correct folder: "/usr/local/php5" or "/usr/local/php5/bin", PHPStorm gives me an error: PHP version: not installed.
However, both via the browser or the command line (php -i), both of my php installations are the same and the php.ini location for both is located at:
/usr/local/php5/lib
Why is PHPStorm not recognizing my PHP installation ? What am I missing ?
Edit1:
Run the following command in the terminal and use the output path as the path of your interpreter.
which php
Related
I have a system build with Laravel 5.5 and it needs PHP version 7.
I have deployed the project to site ground server, updated PHP version using PHP version but when I ran php -v command via putty it is showing me PHP version 5. I don't know what going on.
I shall be thankful if someone tell me that what is the proper way of updating PHP version?
I have also tried AddHandler application/x-httpd-php70s .php in my .htaccess files but got nothing fruitful
You can change the PHP CLI version through SSH. After connecting through SSH type cd ~ and then find .bash_profile file. Open the .bash_profile file with nano or vi which you would like to use and enter this line:
alias php=/usr/local/php72/bin/php-cli
and save the file. After that run command:
source .bash_profile
And your PHP CLI version has been changed. To confirm the PHP version type php -v and it will show you the version which you just changed.
P.S: In my case, I want to change the PHP CLI version to PHP 7.2 so I use php72 in alias php=/usr/local/php72/bin/php-cli. You can change it to any other version which you need.
So there's no problem if you see PHP5 using command line and PHP7 using php file with phpinfo();. Your hosting provider allows you to choose from several PHP version. You can select PHP7 e.g. using .htaccess but it doesn't have to change PHP CLI version. So when you set PHP7 in .htaccess file it serves your website using PHP7, but CLI is still v5.
By the way, this type of question should be asked on superuser I think.
I have installed MAMP 3.5 with Apache 2.4.16 on Yosemite 10.10.5 and have run into some obstacles that I find hard to solve.
The first issue was that virtual host settings have changed in Apache but that I managed to fix.
The remaining problem is with extensions. I use gettext in an application and it can not be found.
php -v says PHP 5.6.10 (cli)
phpinfo() says PHP 5.5.27
php --ini says /Applications/MAMP/bin/php/php5.6.10/conf/php.ini
The php.ini path seems to be correct although phpinfo() says that extension_dir is /usr/lib/php/extensions/no-debug-non-zts-20121212
This seems very strange to me? The gettext extension is not in this directory but is found along with all other relevant extensions in the directory listed in the php.ini file for PHP 5.6.10 which is the one that should be used...
Any ideas what has gone wrong and how I can make PHP use the correct ini file?
CLI uses the installed version of OSX, MAMP uses it's own version.
The easiest way to use same version for both is to add the MAMP version first in your path in ~/.bash_profile.
export PATH=/Applications/MAMP/Library/bin/:/Applications/MAMP/bin/php/php7.0.0/bin/:~/bin:$JAVA_HOME/bin:$PATH
of course you need to replace the php7.0.0 part with the version you want to use.
Quit your terminal app and reopen it, and try php -v again.
I run MAMP on my Mac at home, but on my work machine (Win7) I just started using MAMP for Windows so that I'm running the same (relatively speaking) software between the two machines. I was running some commands from the command line yesterday and noticed that the script was throwing errors because the mbstring extension wasn't loaded. I did some digging and am left scratching my head now...
In the browser, everything works fine. When I check the phpinfo, it's loading the configuration file just fine and mbstring is enabled. When I switch to the command line though, mbstring isn't in the list of modules (php -m). Also, when I do a php --ini, it tells me that no configuration file was loaded. I've added the correct PHP version to my PATH and running php -v gives me the version I expect, so I'm not really sure why PHP on the command line is acting differently from PHP in the browser.
Has anyone run into this before? How do I make PHP on the command line load the same configuration file that the browser is using?
Command line php (CLI) is a different executable to CGI PHP. It also uses typically a different php.ini file. You can however specify the location of the php.ini you would like to load when launching php cli:
php -c <path to your php.ini>
Have a look here.
This example assumes you use C:\MAMP\ as installation directory.
As you need configuration as used in Windows MAMP you will need to supply it as argument to php.
Open command prompt.
To execute test.php with script located in C:\MAMP\htdocs\ by using PHP5.6.0 from MAMP:
C:\MAMP\bin\php\php5.6.0\php.exe -c "C:\MAMP\conf\php5.6.0\php.ini" "C:\MAMP\htdocs\test.php"
As you can notice last argument is the script to be executed ("C:\MAMP\htdocs\test.php").
To execute phpinfo from command line:
C:\MAMP\bin\php\php5.6.0\php.exe -c "C:\MAMP\conf\php5.6.0\php.ini" -r phpinfo();
There should be line from phpinfo output which acknowledges that you're using configuration from C:\MAMP\conf\php5.6.0\php.ini.
Loaded Configuration File => C:\MAMP\conf\php5.6.0\php.ini
I had php 5.3 installed with apache 2.2
I just added php 5.57 x64 with apache 2.4 x64
both setups seem to be working fine in parallel when pulling php pages through browsers
can't run php pages/scripts from command line using the new php 5.57 executable
(I cd to the directory c:\php55 then run the command: php -f c:\... path to template in htdocs)
same php pages/scripts run just fine with 5.3 php executable using same exact command
same php pages/scripts run just fine through browsers using the new php 5.57 executable (configured on port 8080)
I'm on windows 2008 r2
any idea folks?
You should use absolute path. For example
c:\php55\php.exe c:\htdosc\script.php
Also check waht php executable file is in folder c:\php55 May be it in c:\php55\bin
I'm running XAMPP 1.7.3a on Ubuntu 9.10. With Netbeans 6.7.1 as my editor, I want to be able to debug my PHP sites.
To do this, I looked up Xdebug and started following the installation instructions, found here: http://xdebug.org/docs/install.
Trying to compile the .tgz file, run in to a problem.
Step 3) I can execute that, but what use does it have? I don't get the output or what I should do with it.
Step 4) I execute the following command:
./configure --enable-xdebug --with-php-config=/opt/lampp/etc/
At the bottom of the output, it says: configure:
error: Cannot find php-config. Please
use --with-php-config=PATH
I've checked the location I entered, the php.ini file is there and so are all other config files.
So, I'm not sure what to do now. Should I ignore and just do the 'make' command, or does something else yet need to be done?
you have to pass the path to the php config binary - should be something like
/opt/lampp/bin/php-config
All the binaries in XAMPP are located in
/opt/lampp/bin
That's why if you work with XAMPP's PHP version you ought to proceed all operations using binaries from there.
For example, after installation of XAMPP it's possible to set path to it's PHP bin file.