The current version of MAMP that I have only has php 5.2.17 and 5.4.4. I need 5.3.X. Is there a way to add additional versions that can be selected in the MAMP interfaces php preferences? This is for the free version of MAMP, not MAMP PRO.
Thanks
Found a quick fix in the MAMP forums.
Basically it seems MAMP is only allowing 2 versions of PHP to show up. Quick fix, rename the folders you're not bothered about using, for me this meant adding an "X" to my /Applications/MAMP/bin/php/php5.4.10_X folder. Now 5.2.17 and 5.3.20 show up in the mamp prefs.
Done!
Edit - if the PHP version you require isn't in the PHP folder, you can download the version you require from http://www.mamp.info/en/downloads/
Edit - MAMP don't seem to provide links to the alternative PHP versions on the download page any more. Use WayBackMachine https://web.archive.org/web/20180131074715/http://www.mamp.info/en/downloads/
If you need to be able to switch between more than two versions at a time, you can use the following to change the version of PHP manually.
MAMP automatically rewrites the following line in your /Applications/MAMP/conf/apache/httpd.conf file when it restarts based on the settings in preferences. You can comment out this line and add the second one to the end of your file:
# Comment this out just under all the modules loaded
# LoadModule php5_module /Applications/MAMP/bin/php/php5.x.x/modules/libphp5.so
At the bottom of the httpd.conf file, you'll see where additional configurations are loaded from the extra folder. Add this to the bottom of the httpd.conf file
# PHP Version Change
Include /Applications/MAMP/conf/apache/extra/httpd-php.conf
Then create a new file here: /Applications/MAMP/conf/apache/extra/httpd-php.conf
# Uncomment the version of PHP you want to run with MAMP
# LoadModule php5_module /Applications/MAMP/bin/php/php5.2.17/modules/libphp5.so
# LoadModule php5_module /Applications/MAMP/bin/php/php5.3.27/modules/libphp5.so
# LoadModule php5_module /Applications/MAMP/bin/php/php5.4.19/modules/libphp5.so
LoadModule php5_module /Applications/MAMP/bin/php/php5.5.3/modules/libphp5.so
After you have this setup, just uncomment the version of PHP you want to use and restart the servers!
MAMP takes only two highest versions of the PHP in the following folder
/Application/MAMP/bin/php
As you can see here highest versions are 7.0.10 and 5.6.25
Now 7.0.10 version is removed and as you can see highest two versions are
5.6.25 and 5.5.38 as shown in preferences
I'm using the free version of MAMP on mac (27 of April of 2021, MAMP version 6.3) and the #LiveSource answer helped me to find a solution.
My MAMP is not showing more than 2 option on the dropdown and on the /Applications/MAMP/bin/php has 7 options of PHP version. So the MAMP will display the latest 2.
To solve it I changed the name of all PHP version folders that I would not like to use. This way only 2 folders will be compatible with MAMP and my desired versions will display on the dropdown.
I added a _X in the end but you can add anything.
After doing the change, close the MAMP and open it again.
See the screenshots of the solution working.
First stop the Server if its running. Go to "/Applications/MAMP/bin/", rename the PHP Version you don't need (MAMP is only allowed to use 2 PHP Versions), e.g. "_php5.2.17". Now MAMP will use the php versions that are left. Go to the MAMP Manager and then settings, then switch to the php version you need.
One problem with this solution I encountered was the httpd process (took me a while to figure that out xD). If you have the httpd process running in the background, then the php switch won't work, until you stop those processes (sometimes MAMP has an awkward problem to stop the server, thats why this process can be still alive). Start your Activity Monitor on your Mac (Shortcut: Press Command+Space and type in activity...), go to the Search Function and type in "httpd", close all those processes. Now you should be able to switch your PHP Version with the MAMP Manager.
Maybe easy like this?
Compiled binaries of the PHP interpreter can be found at http://www.mamp.info/en/ downloads/index.html . Drop this downloaded folder into your /Applications/MAMP/bin/php! directory. Close and re-open your MAMP PRO application. Your new PHP version should now appear in the PHP drop down menu. MAMP PRO will only support PHP versions from the downloads page.
Additional Version of PHP can be installed directly from the APP (using MAMP PRO v5 at least).
Here's how (All Steps):
MAMP PRO --> Preferences --> click [Check Now] to check for updates (even if you have automatic updates enabled!) --> click [Show PHP Versions] --> Install as needed!
Step-by-step screenshots:
The easiest solution I found is to just rename the php folder version as such:
Shut down the servers
Rename the folder containing the php version that you don't need in /Applications/MAMP/bin/php. php7.3.9 --> _php7.3.9
That way only two of them will be read by MAMP. Done!
Honestly try using Docker had such a headache with MAMP and php versions.
Use this to get it up and running its simple.
https://github.com/harshalone/docker-compose-lamp
git clone https://github.com/harshalone/docker-compose-lamp.git
cd docker-compose-lamp/
cp sample.env .env
// modify sample.env as needed
docker-compose up -d
// visit localhost
In the bin folder you will see your php versions.
Change the version you want to use in your .env file PHPVERSION=php7.4
You can watch this tutorial. Wish I had started using docker earlier it will save you a tonne of issues and time.
https://www.youtube.com/watch?v=MTeY3npy1gU
The file /Applications/MAMP/bin/mamp/mamp.conf.json holds the MAMP configuration, look for the section:
{
"name": "PHP",
"version": "5.6.28, 7.0.20"
}
which lists the the php versions which will be displayed in the GUI, obviously you need to have downloaded the PHP version from the MAMP site first and placed it in /Applications/MAMP/bin/php for this to work.
Related
I have installed the imagick from here (ImageMagick-7.0.3-1-Q16-x64-dll) and the dll (TS 32 bit) from here. And also copiend the CORE_RL_* to the C:\xampp\apache\bin BUT still i get the following error when i run the laravel server.
ERROR: Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_imagick.dll' - The specified module could not be found.
in Unknown on line 0
Also, I placed dll file in C:\xampp\php\ext\php_imagick.dll.
Also, the imagick is shown in the phpinfo().
And when i use it using laravel i get the following error.
getting Imagick to work on Windows has always been a bit hit and miss as pointed out here is a good guide
http://stackoverflow.com/a/36378764/1090867
But it misses an important point
You do not need to put the binary into the PHP folder!
So here are the steps I follow myself every time I need to do this. This should work for apache, Nginx, or IIS.
Step 1
find out your php version and setting
You need to version, Architecture, Compiler and Thread Safety
if Thread Safety is disabled this is NTS is enabled it will TS
Step 2
Get and install a copy of ImageMagick and make sure it matches your Architecture, this also needs to be dll.exe rather than the static version.
Regarding Q8 and Q16 I'll leave that to you but both versions will work
Link
I recommend changing the install directory name to something generic like
C:\Imagemagick since I've had some problems in the past with the default directory name with PHP and windows.
Just install but make sure you tick add application path and I normally tick the legacy utils as well.
Once it's installed go to your environment variables and make sure it is actually in the path. There is no need to copy anything to your PHP folder
Just to make sure everything is working open the command line and type convert --version you should get a response
Step 3
This unfortunately is the hard part and can be a bit of trial and error. I've found the following provides the best php_imagick.dll that seems to work 9 times out of 10
http://www.peewit.fr/imagick/
Just pick the version that matches your install.
If this doesn't work then go to php.net and try each version until one works... (start at the latest)
http://windows.php.net/downloads/pecl/releases/imagick/
Once you have a php_imagick.dll put it into your php/ext/ folder
thne locate your php.ini file go to the bottom (or whereever your extensions are) and add extension=php_imagick.dll
Step 4
Restart PHP (or your computer) and it should be working if not try a different php_imagick.dll and repeat.
If the above doesn't work
Then try a slightly older version of Imagick I normally use version 6.8.6-8 Q16.
Please note I've only ever really done this on Windows 7 and Windows Server 2008, 2008 R2, 2012, and 2012 R2 all x64 with x86 PHP
If this still doesn't work then you probably need to copy over the CORE_RL files into your Imagick directory this normally causes more issues but if you are running out ideas then give it a go
I just ran into this issue. Only I'm using PHP on the command line (PHP CLI). The problem is the dependencies that the main php_imagick.dll file has. PHP will attempt to load the extension but since Windows can't find the CORE_RL_ DLLs, the extension will fail to load and the error/warning message about being unable to load the DLL will appear. It helps to know how Windows loads DLLs:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682586(v=vs.85).aspx
It's pretty convoluted but you can see that the reason the Apache /bin directory trick works with Apache is that httpd.exe is located in that directory. However, when using PHP CLI, the DLLs need to be located in the same directory as php.exe.
If you don't want duplicate DLLs floating around, add the directory containing php.exe to the system PATH and plop all the CORE_RL_ DLLs there. The PATH is the last thing searched, but it'll work fine. If you don't want spurious entries in your system PATH, then set the extra PATH information only during startup of Apache.
This is because the dependencies are missing. Those who are facing the same error Unable to load dynamic library 'php_imagick', Please follow the below steps
Go to https://pecl.php.net/package/imagick choose a stable version and click on the DLL link.
From the DLL list click the link which, is suitable for your PHP version.
After downloading the php_imagick zip file, extract it and copy the php_imagick.dll file to C:\xampp\php\ext folder.
Extract all DLL files from the php_imagick zip file (except php_imagick.dll) to the PHP root directory (where you have php.exe). Ex: For XAMPP user C:\xampp\php folder.
Add extension=php_imagick to your php.ini file.
Restart the Apache server.
Things to keep in mind before choosing from the DLL list.
Check the PHP version.
Check the architecture (x64/x86).
Check Thread Safety (enabled/disabled).
N.B: Above solution is for XAMPP users only.
I changed php_imagick in php.ini file to php_imagick.dll and it happened
I had the same problem. It turns out I have to install complete ImageMagic application, not just ImageMagic php extension.
And I also set MAGICK_HOME environment variable.
I was to load multiple version of php on xampp, and using ht-access add handler, so my one application should run in 5.3 php version using its htaccess and another application should use 5.4 php version.
can anybody please help me to deal with this?
Thanks
Amit
One way to do this is to have your main version of php set up with mod_php and run all of the others through fast cgi on different ports (i.e. 81, 82, 83 etc).
The best method is to change the PHP settings in
/apache/conf/extra/httpd-xampp.conf
to reflect the new version of PHP you want to use
In my case I unpacked PHP5.4 to C:\XAMPPLITE\PHP5.4 and then updated key lines in this file such as:
SetEnv PHPRC "C:\\xampplite\\php5.4"
LoadFile "C:/xampplite/php5.4/php5ts.dll"
PHPINIDir "C:/xampplite/php5.4"
You also need to ensure that the correct version of php5apache2_2.dll is installed
To ensure this I copied the new version of php5apache2_2.dll to the Apache modules directory with a unique name, and then modified the configuration to match that:
copy php5.4\php5apache2_2.dll apache\modules\php5apache2_2-5_4.dll
and in the httpd-xampp.conf file
LoadModule php5_module modules/php5apache2_2-5_4.dll
Firstly, please forgive me if this is in the wrong section (and could you tell where this should be?)
I am starting to use Laravel, and it requires PHP with Mcrypt.
So I followed the tutorial for Homebrew and have got PHP5.4 set up with Mcrypt
Typing which php and php -v at the terminal all confirm that this PHP 5.4.24 is loaded and are ready to go.
However, the output of phpinfo() in the localhost directory (via Apache) shows I am using PHP 5.4.17 with no Mcrypt.
OK, so I know I should have set up the httpd.conf with:
LoadModule php5_module /usr/local/opt/php54/libexec/apache2/libphp5.so
And when I do that, I get the right PHP version in Apache, but PHP seems to fail in subdirectories.
I have a file index.php at localhost/test containing <? echo phpinfo();?>, and...
...it works when the line in httpd.conf says this: LoadModule php5_module libexec/apache2/libphp5.so...
...but does not work when I change to homebrew's suggestion.
Any ideas?
TL;DR...
When I set up httpd.conf to work with php54 (installed via Homebrew), then PHP is executed in the home directory of localhost, but not in the subdirectories.
Oh. You. Idiot.
This post proves that I am, without a doubt, the biggest fool that walked the earth.
Clearly, short tags are turned off in the newer version of PHP but not in the older one.
So everything was working fine - if only I had used <?php echo phpinfo(); ?> then I could have saved about 8 hours of tears.
I'm trying to setup an Apache/PHP/Postgresql server locally on my machine. I'm using Windows vista business 32bit. I tried to install everything manually (one thing at a time, apache, postgresql and php (all the latest stable releases)) and after I get everything up and running.
Whenever I try to run a script on my machine, I get a "What do you want to do with the *.php file?" dialog. The dialog is the browser's open/save dialog
I'm just trying to get the output of phpinfo() to make sure everything is up and running...
I already tried to mess around a bit with the Apache conf file, but since I don't know much about what I'm doing, I reinstalled everything again and the problem is still there. I kinda get the feeling it must have something to do with the PHP thingy isn't correctly installed.
When i try to get the output of phpinfo as in:
<pre><?php
phpinfo();
?></pre>
I get the browser's "Open/Save" dialog for the *.php file.
You should have something like this in your httpd.conf file:
LoadModule php5_module "c:/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
PHPIniDir "c:/php"
Make sure that's in place, and don't forget to restart apache!
In Windows, the default location for your conf file is C:\Program Files\Apache Group\Apache2\conf\httpd.conf
You can also have a look at the official page of PHP in the install section.
There is a closer link if you are on Windows.
And you can also use some precompiled installer for this like XAMMP and install Postgres after all is set up and running with the web server and php.
are you on Windows?
I use Wamp server, which is an excellent way of getting Apache, MySQL and PHP installed and configured without any hassle on Windows.
If you want to use Postgres instead, provided that you've got it installed separately it will work fine. (one great thing you can do with Wamp is add and remove PHP extensions via a GUI pretty much on-the-fly, and pgsql is one of them).
Maybe somebody can help, but you'd be much better off if you'd provide some relevant details.
What sort of system are you using? Be specific.
What do you mean by "everything up and running"?
What are you doing when you "try to run a script"?
What installation procedures did you use? (If you were following them off a script or how-to, we at least need to know where to find the script or how-to.)
We don't automatically know these things. What seems obvious to you may not be clear to us, and what seems irrelevant to you may turn out to be crucial.
In httpd.conf, make sure the PHP module is being loaded and that that line isn't commented out. (Comments in httpd.conf starts with #.)
Also what OS are you running?
I had the same problem, You need to configure apache and add the php module...
e.g I compiled the php from source as well as the apache. After doing so I then copied the libphp5.so from php/lib dir in to the apache/modules dir. Than you have to add php in the http.conf
LoadModule php5_module modules/libphp5.so
AddHandler php5-script php
you can then restart apache....it's not the most elegant of solutions but it works.
I'm trying to use php_dio & php_win32service because I want to query COM10 on my server using php and also get status & restart some of my win services.
Although I'm using the correct dlls (for PHP 5.5 X64 thread safe) I keep getting warning icon on the extensions and there is no error on php log.
I'm clueless what can be done.
please advise.
The Warning icon is presented in that menu for 2 possible reasons
The extension=php_xxx.dll exists in the php.ini file but the dll does not exist in the \ext folder.
The dll exists in \ext folder but the extension=php_xxx.dll line does not exist in the php.ini file.
So which did you forget to do?
Also remember there are 2 php.ini files :-
The one in \wamp\bin\php\php{version}\php.ini is used by PHP CLI only
The one you can edit using the wampmanager->PHP->php.ini menus which is used by when running under Apache.
You say you have used the correct dll's but just to be sure for WAMPServer 2.5 using Apache2.2.9 you need the Thread Safe + VC11 compiled versions