Recently I installed XAMPP for doing local development on my Windows 7 machine. I honestly didn't think PHP was installed at all before hand. I installed the latest version of XAMPP and configured for php 5.6.24. I created some virtual hosts and everything seemed to work.
I was having an issue and I needed to confirm which version of PHP I was using so I opened up my command line and typed php -v. For some reason it is reporting I'm using PHP 5.4.25. The exact line is PHP 5.4.25 (cli) (built: Feb 5 2014 21:19:58)
I don't recall using this version (I had Visual Studio Community installed recently, is that related?). I don't understand either why my CLI is reporting one version, when XAMPP supposedly installed another version. Am I missing something? I need to run some gpm commands for the latest version of Grav CMS but when I do it says it required at least 5.5.9.
It is possible to have multiple versions of php installed.
You will want to ensure that you are executing the php-cli that came with XAMPP.
It sounds like you have another version of php installed and is in your PATH so that when you run php that version is loaded.
You can use the where command to find out what file is being loaded.
From the terminal type: where php
I am not a windows guy but there is a which command on linux. Apparently this is the command for windows. Here is a SO post about it:
Is there an equivalent of 'which' on the Windows command line?
Anyways, you may want to remove that php file and possibly create a symbolic link in its place for the XAMPP version of php-cli
If you remove/rename the file and the new php-cli is not in your path, you will probably get an error as the system will not know what php is.
The solution to this is to uninstall all the xampp's that are installed and then fresh install xampp with php version > 7.
Everything should work fine then.
What happened to me was that I had installed xampp two times. One
xampp on my C:// (version 5.6) and one xampp on my D:// (version 7.2)
When I did the command on my D:// xampp
php --version
It took the xampp php version from the C:// instead of the D://.
Related
I'm running Uwamp server under windows7 and it works perfectly with php versions from 5.5 to 7.0.3 and with curl enabled.
When I switch to php 7.2, 7.3 or latest 7.4.3 uwamp server still working - but without curl.
php_curl.dll file is enabled under extensions (ext) but phpinfo() confirms that curl extension is missing / not enabled. I compared php.ini with previous php versions, modified it but it still doesn't work.
cURL is NOT installed on this server
I have testet xampp and this server has no problem with curl and php 7.3/7.4. I compared php.ini etc. but curl extension still not working under Uwamp.
It seems that the author of the project has abandoned it, because there have been no updates or activities since many years. Maybe someone using it and can help me to solve it.
Any idea would be greatly appreciated!
finally got a working solution for this problem of uwamp and running an up to date version of php and getting curl working.
I have sat here for a couple of days trying to work why you couldn't get a later version of php 7.0.3 without breaking uwamp and curl. So I learnt how to integrate and test php apache as standalones and then working on updating uwamp. Lots of head scratching of working out how uwamp uses its on the fly configuration setup.
I will list all the steps to update your version of uwamp (to apache 4.2 and php 7.4.4 as of Mar 2020)
Download uwamp (portable or installer)
Download c++ runtime https://aka.ms/vs/16/release/VC_redist.x86.exe (taken from the windows php page)
Install the runtime above
Install uwamp to a directory (in this example will just use c:\ making it install to c:\uwamp after expanding)
Before running uwamp
Goto to apache lounge website and download the latest 32 build of apache (4.2)
https://www.apachelounge.com/download/VS16/binaries/httpd-2.4.41-win32-VS16.zip
Expand this archive, it should create a folder called apache2.4
Step in to this directory and copy all the files and paste them here in your uwamp folder (c:\uwamp\bin\apache). This should overwrite all the apache files and add the latest apachephp dll
TIP. Just make sure you havent expanded the apache2.4 zip in the uwamp apache folder, easy to tell as you will see a apache24 appear
Goto to php.net and download the latest THREAD SAFE version of php (7.4.4)
https://windows.php.net/downloads/releases/php-7.4.4-Win32-vc15-x86.zip
Extract the php zip this folder in to the c:\uwamp\bin\php in to a new folder with name of php-7.4.4 (so the files should be in c:\uwamp\bin\php\php-7.4.4)
There you are, you have completed your manual upgrade of uwamp , run uwamp and if no errors appear with in the GUI, everything should be working. Test by opening a browser and use http://localhost/uwamp/phpinfo or http://127.0.0.1/uwamp/phpinfo or click the "phpinfo button" in the uwamp GUI
This way seems to allowed an upgrade of uwamp (except sql) but resolve a common problem of php and curl not working / breaking.
This works for x86 version installed on a 32/64 bit system.
Still trying to work out the kinks for uwamp to be running 64 bit apache and php but should be possible.
Try and delete the version of PHP that is affected by the missing Curl extension and then re-download the version from inside the AWamp interface. I have had similar problems with other extensions and have solved it this way.
I have installed both PHP versions (php5 & php7) on the same Linux server and it works for me, when I switch the version configuration on system.
Also it shows changes happen in the info.php file in the browser, but in terminal using php -v ,it shows only php7 version installed though it works under php5.
how can i correct the version information in php5 while chk in terminal?
When PHP is installed side to side there are different executables for the different versions. When you use a Web Server you choose which version to use via its configuration.
If php -v shows PHP 7 try php5 -v. If this returns the right version you can use php5 to run any script with php5.
To find out where exactly the PHP executables are use:
which php
whereis php
which php7
whereis php7
Can't find this online, probably not describing it properly because I'm pretty sure I am not alone with this problem.
I have vagrant running for a few months now, with PHP 5.6. Now I upgraded to PHP 7, but when I request my php -v inside Homestead in Terminal it still gives me version 5.6.
When I request my PHP version with this snippet <?php phpinfo() ?> inside a webpage I DO get version 7.
Is this normal or am I forgetting something?
Thanks
UPDATE
I have version 7.0 in my vagrant ssh right now. But apperently there is a different environment for ssh, ftp, code, ...
How do I set all of these versions to the same (obviously the latest 7.0 version)
Try this and if it's the right path of php7 you can use php7.0 instead of php
/usr/bin/php7.0 -v
I am having a strange problem with PHP on a raspberry Pi lately.
It occurred as i tried to run the "password_hash" function and wonderd why it didn't work. The script didn't even throw an error or something, it just didn't continue.
The specs first:
PC = Raspberry Pi I
OS = Raspbian
Installed Apache Version = 2.4.12
Installed PHP Version = 5.6.15
All these specs are coming from the console.
So it turned out, that the PHP version used by apache is different from the one i got from the console. Installed is PHP 5.6.15 but used is (acording to phpinfo() ) PHP 5.4.45. The php.ini is correctly located.
The more weird part is, that the apache version (also acording to phpinfo() ) seems to be Apache/2.2.22 (Debian) and i can't figure out why.
So intuitive i removed and reinstalled php and apache, checked the versions in the console, where it was correct (again), run another script with only phpinfo() and got the same sobering results. I also tried to install it manualy. And to get this out of the way, i did not upgrade the PHP version, it was a clean install on a clean, recently installed OS.
Had any of you ever run into something similar and knows a way to fixed it?
I have just bought a VPS running Ubuntu and I need to install the LAMP stack with PHP 5.1.6. The VPS came with no PHP installed (checked this from the shell with php -v) and with Apache/2.2.12 installed. I installed PHP 5.1.6 from source and compiled it with Apache 2.2 (using libapache2-mod-php5), tried a phpinfo() test which worked fine, however, phpinfo() shows the PHP version as 5.2.1 (with JSON enabled), whereas running php-v in the shell shows as 5.1.6. Anyone any ideas what might be happening here? I need to ensure I am running PHP 5.1.6.
Thanks in advance for any help!
php -v gives you the version of the cli installation of php, while phpinfo will give you the version which got installed as apache module.
If you are not using cli php anywhere, you should be fine with running php scripts off apache.
But ideally you should fix this.