How to tell MAMP which version of PHP to use? - php

I've installed PECL for PHP on MAMP. Unfortunately, it is using php 5.3.6 which is different form the most recent version of PHP(which is 5.4.10 today). When looking a phpinfo, I see that it is not loading the php.ini file I want (5.3.6), it is loading the latest one (which is normal)
How to tell MAMP which version of PHP to use ?
Thanks

Check your Prefences pane. Should you want specific versions, you will need to install them manually or take a look at this thread.

1 - Download the desired version of PHP here (listed on the right).
2 - Two cases:
Either you have Mamp pro and you can change it through the user interface or you have the free version of Mamp and can achieve that, renaming each folder with for example .DIS at the end at /Applications/MAMP/bin/php/ and just not renaming any version of php, plus the one that you are going to import and consequently copy-paste. This is because the free version of Mamp only allows you to see the two highest version of php through the user interface (for more information watch this video tutorial which will give you more details about the process to follow).

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.

Why does MAMP not change the php version

I just went from windows to mac and am now trying to import my local wordpress projects from xampp to mamp. I have some issues with my websites and I suspect it is because of the newer version of PHP that MAMP uses.
In the preferences MAMP offers "7.1.0" and "7.0.13" but when I change to the older version and click "save", MAMP restarts the servers and when I check the settings it is back to "7.1.0".
How can you fix this?
I was able to change the PHP Settings after changing the available PHP versions that MAMP offers. I did this by going to "/Applications/MAMP/bin/php" and renaming one of the folders, for example adding "_X" at the end. By renaming the folder of one of the 2 available PHP versions you remove it from the selection. Afterwards I was able to change and save the standard PHP version.
A bug was recently submitted on Mamp's Bugbase but it is unresolved at this moment. Meanwhile, the solution described by koedev, as well as the solutions found at the workaround cited by Arda Kazanci could be used.
Globally, two different solutions are available in the workaround cited by Kazanci: The koedev solution, that is, adding a _X in folder's name, and a second one that seems to be more professional, that is, adding an "extra" folder to httpd.conf and "selecting" inside which php versions should be used by mamp. Because some users didn't succeed in making work the extra configuration of httpd, it may be faster and simplest to follow the koedev solution.

Is there a way to run PHP version 5.4 w/ the latest MAMP version

I have the latest version of MAMP installed but i want it to run PHP version 5.4.
That version is included in the MAMP file dir. It is located…
-> bin/php/php5.4.42
but in the preferences pane there are only 2 PHP version options: 5.6.10 and 7
I want to do this a part of troubleshooting. i have a Drupal install and am getting the dreaded ‘White Screen of Death’. I’m trying anything and everything to get it working!
MAMP lets you choose from the last two versions of PHP installed in bin/php. If you want to use 5.4.42, just leave this folder and another one of your choice inside this directory (move the others somewhere else so you have a copy, just in case). When you restart MAMP you'll be able to choose your preferred PHP version in the Preferences.
You can download more versions at https://www.mamp.info/en/downloads/
The easier way is to use other localwebserver called Ampps, and after installing it you can choose the version you want by the simple interface it provide.
You click on PHP ==> Change PHP version, and it will show you versions from 5.3 to 7.0.
Here is the link: http://www.ampps.com/
Thanks a lot.

Apache service refuse to start on wamp 2.5

This is my issue and it has given me sleepless night.
I have been working on the wamp 2.1 server environment for the past 3 years and now i want to upgrade. I finally installed wamp 2.5 and would be willing to keep my previous wamp 2.1 version. everything looks good, because after installation, i did the following after:
Copied ?:\wamp_old\bin\apache to ?:\wamp\bin
Copied ?:\wamp_old\bin\mysql to ?:\wamp\bin
Copied ?:\wamp_old\bin\php to ?:\wamp\bin
Now, the issue is this:
Whenever i start the wamp server with the latest version, it works and the icon turns green. but whenever i try changing/switching back to the old version, all the services starts except the Apache. the icon stays orange and never turns green. whenever i click test port, it tells me your port 80 is not actually used. when i click on install service, i get this message: your port 80 is available, install will proceed. when i select remove service, it removes immediately. when i click start/resume service, nothing happens and it never starts.
What I want to achieve is this:
Some old joomla site were developed on the former wamp 2.1 and each time i tried accessing them via the new wamp 2.5, i see some deprecated functions and it display some chunks of codes. meanwhile, i have two projects that refuse to run on the old wamp 2.1, so i decided to run the 2.5. Presently, the system has wamp 2.5 running.
For 5 days now, i have been cracking my head and i have been stucked.. someone out there should please help me with a solution to run wamp 2.1 and wamp 2.5 together so i can switch version easily. or a probably solution will be appreciated.
Kind Regards !
You were on the right track copying the old Apache MySQL and PHP folders into the new 2.5 version.
Unfortunately switching to very old versions from the new ones is now a bit more hassle than it used to be because of the changes made in the version of compiler used to compile Apache and PHP.
Your old versions of Apache and PHP were compiled with MSVC6 and the new versions with MSVC11 and the 2 are not compatible i.e. an Apache compiled with VC11 wont run with a PHP compiled with VC6 etc.
So try this :-
Switch from Apache 2.4.9 to your old version, it wont start because the PHP version will still be 5.5.12.
Ignore the problem.
Now switch to an old version of PHP, thats compatible with the old Apache.
With luck it will now work.
Check you have the correct version by looking at phpinfo
If it does not come up re-do the switch to the old apache and then again to the old PHP by just re-clicking the version numbers on the relevant switch menu.
To be honest I don't know if it would be possible to restore everything to work fine. I had once similar problems - I had Wampserver and installed new PHP version for WAMP and switched to new PHP version and eveything stopped to work. I tried to change PHP version to the previous one but I had info it's not compatible with Apache and I couldn't change PHP version because of chosen PHP version.
Now I moved to easyPHP and it's much more easier, you can have many PHP versions, there's no problem with changing them.
Probably in your case the problem was not WAMP itself but PHP versions. That's why when you launched your older code you have many warnings. You should simple select older PHP version to do that or you simple have to turn off warning (maybe for other PHP version you had turned off displaying warnings by default?).
If I were you, I would move to easyPHP, dump your databases (if any) and move everything to easyPHP. Probably you won't make your installation of WAMPserver work so the other option is backup everything, dump your databases and reinstall WAMPserver but you can be almost sure similar problem occurs sooner or later when you will be switching between PHP versions.
After alot of brainstorming, I finally resolved the issue all by myself.
Though it may not look wise, but i believe it could go a long way to help others who are stucked in situations like this.
First, I started the wamp 2.5, changed all the versions to the latest ones, which is Apache, Mysql and Php... when the icon turned green, I decided to stop all services, uninstalled the services one after the other. (Apache and mysql) and exit the application by right clicking.
Secondly, I renamed the wamp which encapsulates the 2.5 version to wamp_2.5old and renamed the 2.1 folder back to wamp. i launched the wamp and installed the services back again..this time, it was a lower version. both php and apache had just one version while my sql had two. I made sure the right version of sql was selected and i installed it. I restarted all the services, the icon turned green and all my old website worked.
I tried the method vice-versa and all my latest projects worked. it might look challenging but thats my own way of discovering running multiple version of wamp.
Lastly, thanks to Özgür Eroğlu and Marcin Nabiałek.. they have been of helped.
Pleas help me flag this as useful for research..
vielen gluck.. good luck guys !

php_monetdb.dll

I need the php_monetdb.dll for php 5.4. I've found that by building the monetDB with the HAVE_PHP=1 option on windows will create the dll, but the build procedure fails at numerous points. I am using the monetdb source from sourceforge which is a little outdated one. The newer version has problems in the .msc files itself so proceeding to the build itself is a pain. The older version that I am trying on is atleast passing the nmake step but failing on the nmake install step. The reasons vary from component to component. One states that the devenv /build does not exist. For this I copied the vcexpress and renamed it to devenv. I am not sure if this is right but when I run it from the command prompt it seems to work ok with a few warning alerts shown. During other make installs, the header files seem to be missing. Could anyone please help me with this. Also please let me know if there is any other alternative for this approach of getting php_monetdb.dll.
P.S: I am using windows 7, MSVC 10 express, PHP 5.4.4
For the build questions, see http://bugs.monetdb.org/show_bug.cgi?id=3121
For php_monetdb.dll, see
http://sourceforge.net/mailarchive/forum.php?thread_name=20120717145132.GU49719%40cwi.nl&forum_name=monetdb-developers
http://sourceforge.net/mailarchive/forum.php?thread_name=500581D5.8030808%40acm.org&forum_name=monetdb-developers

Categories