PHP Version in Wamp and Command Line Windows not compatible - php

So basically i am trying to run yii-framework on wamp server but required higher version of php (5.4 above). In my Wamp server, the php version is 5.5 which i have checked on browser (localhost). But the when i run it on windows, it fails because the windows version is only 5.3. It causes the yii framework fail too because when i type php requirements.php. it does not work.

There is no Windows version of PHP so basically you must have installed a version of PHP manually i.e. not with WAMPServer.
This will probably have added an entry on you PATH ( always a bad idea when using WAMPServer anyway as you can have many versions of PHP on your system at one time with WAMPServer)
Look at your PATH and if you must, amend it to point to the PHP in \wamp\bin\php\php{version}
A better way is to remove any reference to PHP from the PATH environmant variable and write a simple batch file to add php to your path only when you want to, like this
Batch file saved in C:\windows\phppath.cmd
echo off
PATH=%PATH%;c:\wamp\bin\php\php5.4.16
Assuming you have php5.4.16 on your wampserver install.

Related

Multiple PHP / Apache Versions on MacOs

At the moment I'm using two machines for Web (Win10) & iOS development (MacOS) and looking to combine them into a one computer that I would use on a daily basis.
My current challenge is to ensure that I can develop and run two or more environments on the same machine (not necessary at the same time, a simple switch would do the job).
I've tried MAMP and AMPPS and they both do the job, with an exception to the PHP-CLI version.
Every time I run php from the console it opens up the latest version completely ignoring the one that is specified by the MAMP or AMPPS.
What is the best way to ensure that php-cli always points to a currently active version of the PHP as stipulated by MAMP or AMPPS?
On Windows I was using https://ospanel.io/ that had it's own internal terminal window that would automatically load the current version of php-cli.
I am fully aware of docker/vagrant but they would be an overkill in this case.
Thanks
Unfortunately there is no simple answer to my question. As a solution:
Get multiple version installed
Design a script that changes the PATH environment to the right version as required.
alternatively a script that rewrites a symlink to a required version of the PHP.
For MAMP user, you must edit the file /usr/local/etc/httpd/httpd.conf and set the PHP version you prefer to use in your stack. I only installed one version of Apache HTTPD with multiple PHP versions - you have to specify the version.
If you don't, the default is the Mac's pre-installed PHP version.

Upgrade PHP on XAMPP 1.8.3 windows 7 installation

I have XAMPP 1.8.3 installed on my windows 7 machine. Which include PHP 5.5.6. I want to upgrade the PHP to 5.6 version. Is it possible to do the upgrade while keeping the XAMPP bundle other module as it is (Apache, MySQL). Can any one suggest a way to do upgrade on windows 7.
Download the package from following url:
http://windows.php.net/download/. Make sure the “Thread Safe” zip
file with around 20MB was downloaded.
Extract and rename the folder to “php”.
Rename the existing “php” folder to something and place the new
bundle with folder name “php”.
Then restart the apache server. It will simply load the new PHP
version.
Try like this:
How to upgrade php in xampp:-
Lots of time you need to use multiple version of php for your
different project. In this case either you want to install xampp on
different port or you can install one xampp and upgrade php. In this
article I will demonstrate how you can upgrade php in your xampp
server. I will demonstrate the complete process by adding PHP 5.4
with XAMPP. Following is the step by step process of upgrading php
in your xampp server. Before trying these steps please take complete
backup of your code and database alognwith xampp because any small
mistake can lead to the corruption of your regular XAMPP.
Upgrade PHP in XAMPP server
Download PHP : If you are using xampp ofcourse you are using windows operating system. So first download your desired version of php binary from http://windows.php.net/download/ website. Be careful while choosing binary. If you are using XAMPP then your webserver is apache. So always download Thread Safe binary. Also read the compiler suggestion carefully on the windows.php.net site. I will recommend to download zip version.
Configure New PHP Version with your xampp: Unzip the downloaded version of the PHP in a separate folder. Please make sure that your new php folder name is not “PHP”. May be you can use folder name as the version name. For example for php 5.4 you can use php54. Copy the new php folder into your xampp folder. Now go to yourxampp/apache/conf/extra folder. Open file httpd-xampp.conf from the folder extra. Change the following variables:
Variable PHPINIDir to be your xampp folder new version of PHP
Varaible LoadModule to be your xampp folder/new version of PHP/php5apache2_2.dll
Save the file httpd-xampp.conf. Restart your XAMPP apache server. If your server get restarted successfully then your server php version is upgraded. You can check the status of your php version by URL http://localhost/xampp/phpinfo.php .

Apache and Command Prompt running two different version of PHP on windows

Yesterday, I installed Pear. During installation it asked me installation path of php. But, i mistakely entered different path. So, Pear installed different php version in that Path.
Problem
Now, my apache runs php v5.5 as always. But, from yesterday, command prompt runs v5.3!
How can I make changes so that command prompt runs same version as apache i.e. v5.5.??
I am using windows.
Edit your path variable, replacing the path to v5.3 with the path to v5.5. This guide provides some good info on how to edit the system path.

XAMPP change PHP version

I am working on an older project that uses functions not supported by the newer PHP version included in my version of XAMPP.
I want to temporarily change to an older version of PHP, so I'm looking for a way to switch between PHP versions in XAMPP.
Unfortunately, refactoring to use the newer version of PHP is not an option.
I would not dare to 'temporarily' shift my development machine.
I would suggest installing a virtual machine manager like VirtualBox and then install a older version of XAMPP in there.
I am really disappointed with the responses on this.
WAMP allows you to switch between PHP and MySQL versions pretty easily...
I did following steps on Windows:
Download your XAMPP with your desired PHP version (the VC-11.zip version)
Unzip on C:/xamppXXXX/ (XXXX -> Your PHP version, for example), so you'll have both C:/xampp/ (your first installed version) and the new.
3a. Find in all .conf, .ini, .bat files from the xamppXXXX folder /xampp/ and replace for C:/xamppXXXX/. You can use any IDE like SublimeText to find the string.
3b. Find in all .conf files from the xamppXXXX folder \xampp\ and replace for \xamppXXXX\
You can start MySQL from your installed version control panel and open the C:/xamppXXXX/xampp-control.exe and launch Apache from this one.
I did this with php7 installed and php5 from zip and working fine. Opening different instances of XAMPP Control Panel is the best way to have all databases together and not losing them between versions.
Dont' use XAMPP for this. Use MAMP. It's a single click

Change PHP version in IIS 6

Trying to upgrade from PHP 5.2.5 to 5.2.17 (and then to 5.3.6 once that works) on IIS 6.0, installing the language itself runs just fine and I changed the PHP.ini/ect locations that IIS uses for PHP, everything still works but when I run PHP info on my site it still says it's running PHP 5.2.5. Restarted IIS, restarted the server even, no difference. What do I do to change which version/what location of PHP IIS is using?
When I install PHP 5.3.6 the site no longer works, so I know installing different versions is doing SOMETHING, but I think it might only be changing the PHP.ini my server is using, not the version of PHP.
In addition to installing the windows binary release of PHP I've also tried installing PHP from Microsoft's Web Platform Installer (both 5.3.6 and 5.2.17), after installing neither showed up as the current version in phpinfo either.
If you want to use php 5.3, you must install IIS FastCGI extension and run PHP as cgi script. From php 5.3 isapi is not supported. But everything works fine if you configure it, and as benefit you can use more php version simultaneously. IIS 6 is not a problem. Download PHP non thread safe.
For details see this, for example: http://learn.iis.net/page.aspx/247/using-fastcgi-to-host-php-applications-on-iis-60/
Download the latest VC11 x86 Non Thread Safe version of PHP from http://windows.php.net/download/
Once the zip is downloaded, right click on the zip file and select properties. Make sure you unblock the file.
Rename your current PHP folder to PHPold.
Find your php.ini file and rename it to phpold.ini
Extract the zip file to c:\temp\php.
Copy the php folder from c:\temp to wherever your old PHP folder was.
Go to your new php folder and copy php.ini-production and paste it to where your old php.ini file was
Rename php.ini-production to php.ini
On the server, make sure you have Notepad++ along with the Compare plugin. If you need the compare plugin, use these steps. http://www.davidtan.org/how-to-compare-two-text-files-using-notepad-plus/
In the location that stores your phpold.ini and php.ini, right click on each of those files and open them with Notepad++. On the php.ini, only make changes to the lines with the >> next to them.
Once the changes have been made, make sure you save php.ini.
Go to Services and restart IIS.
Solution has been to move to Apache in my case. IIS 7 has better tools but IIS has proven to be a poor environment for development in this case.

Categories