Different versions of PHP on OS X 10.9 - php

I am trying to get the Symphony framework installed on my laptop (running OS X 10.9 Mavericks), so far I can't even get it started because of error messages
The first thing not being an error but it seems that I have multiple versions of PHP running and I would like to remove everything except the latest version (5.5.12). Can someone please tell me how I can achieve this?
I compiled and built the newest version of PHP from source and installed it (which should replace the original version), however I am seeing 2 different versions when using phpinfo() from a webpage and php -v from the command line:
phpinfo(): PHP Version 5.4.24
php -v: PHP 5.5.12 (cli) (built: May 29 2014 11:21:46)

I compiled and built the newest version of PHP from source and
installed it (which should replace the original version), however I am
seeing 2 different versions when using phpinfo() from a webpage and
php -v from the command line:
PHP from the command line is 100% different from PHP as loaded via an Apache module. So wiping out the old version won’t solve this issue & might cause other issues. Don’t ever attempt that. Instead just install the version of PHP you want to run and edit your Apache config to load the proper libphp5.so PHP 5.5.12 module.
In my Mac OS X 10.9.3 install the default system Apache config is located here:
/private/etc/apache2/httpd.conf
And in there is a commented out line—might be uncommented in yours—that reads:
#LoadModule php5_module libexec/apache2/libphp5.so
So you need to just make sure you create a similar line to the libphp5.so PHP 5.5.12 module like so:
LoadModule php5_module /path/to/the/new/version/of/php/libphp5.so
Making sure to change that /path/to/the/new/version/of/php/ to match your actual libphp5.so PHP 5.5.12 module.
Then restart the Apache web service & all should be good.
Remember this: When it comes to Unix/Linux tools & configurations, you never have to forcefully uninstall components to solve issues like this. It’s all about getting the configuration straight.
All that said, you might make your live easier by running MAMP instead of compiling from source like this. MAMP is a self-contained LAMP stack for MAMP that has the latest versions of PHP installed. And since it runs as an application, none of the issues you are facing compiling from source will ever happen when you use MAMP.

Thanks for your help. I realized that I had installed so many things with MacPorts (programming my Arduino among other things) that I just decided to wipe my drive and reinstall OS X 10.9
Then I just followed this tutorial and finally got everything working properly
http://dab.io/posts/install-symfony-on-os-x-mavericks.html

Related

How to enable curl in php 7.3+ in uwamp server

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.

Installing multiple PHP versions on Ubuntu Server

Initial Situation:
I have an Ubuntu 12.04 Server hosting 3 Websites (with Apache 2.2.22)
How can I install a different PHP version for only one of the Websites?
(The other 2 should remain as they are)
Current PHP Version: PHP 5.3.10
Desired PHP Version: PHP 5.6.16
What i have done/understood until now:
I have already tried out PHPBrew:
http://phpbrew.github.io/phpbrew/
I managed to install PHP 5.6.16 for the command line (with PHPBrew) but the Apache still uses PHP 5.3.10.
I understood that i should end up with an *.so file which i need to place in /etc/apache2/httpd.conf file. (this file is empty at the moment)
(via LoadModule...)
But: I don't have any *.so files.
I installed PHPBrew like this:
phpbrew install 5.6.16 +default +mysql +mcrypt
I think I should have added +apxs2=/usr/bin/apxs2 but if I do this i get the error "Exception: apxs binary is not executable: /usr/bin/apxs2".
How can i fix this?
Or is there a better way to run different PHP versions on one Server?
What is the best way?
Double check the .so files, they should be in `/usr/lib/apache2/modules/``
Then you should edit your /etc/apache2/mods-enabled/php5.load and specify the .so file that corresponds to your installation, in your case:
LoadModule php5_module /usr/lib/apache2/modules/libphp5.6.16.so
An alternative solution for running multiple PHP versions on the same box is using Docker, see my answer in another thread: Multiple PHP versions on the same box
Note that with this solution different PHP versions will be available on different ports.

Error loading PHP 5.5 Module into Apache 1.3 (OpenBSD version) on OpenBSD 5.6 platform

I am trying to configure a server using Apache 1.3 (apache-httpd-openbsd) , PHP 5.5 and MySQL on an OpenBSD 5.6 machine.
The problem occurs when i try to load the PHP module into Apache. I have added the following line in my httpd.conf file:
LoadModule php5_module /usr/local/lib/php-5.5/libphp5.so
The problem is that when i try to load this file by using
apachectl start
I get a bunch of errors like this:
/usr/local/sbin/httpd:/usr/local/lib/php-5.5/libphp5.se: undefined symbol 'apr_bucket_eos_create'
It seems that the PHP library refers to APR methods in Apache that should be included in the Apache distribution that i have. How can i help PHP to find those methods and be able to run on my server?
I found the issue and the solution.
After investigating my configuration further I noticed I had the Apache 2 version of PHP installed (php-5.5.14p0-ap2) instead of the correct 1.x one (php-5.5.14p0). APR in the 1.x versions of Apache uses "ap_" instead of "apr_" in their method signatures which was the cause of the problem.

Homebrew PHP5.5 failures OSX

I am on OS X 10.9.5.
I installed Php 5.5 via homebrew and also the PHP 5.5 mcrypt extension, php55 and php55-mcrypt in homebrew. In order to enable php5 in apache, I added this to /etc/apache2/httpd.conf
LoadModule php5_module /usr/local/opt/php55/libexec/apache2/libphp5.so
I'm using Laravel and need the Mcrypt extension, so I added this to /usr/local/php/5.5/php.ini
extension=mcrypt.so
In order to force the terminal to use the proper PHP version, 5.5, rather than the 5.4 the computer shipped with, I renamed /usr/bin/php to /usr/bin/php-old, and now the terminal falls back to /usr/local/bin/php, which is the version 5.5 that I'd like to use. Now, I am getting the following error in the terminal whenever I do anything in php from terminal.
[Sat Sep 20 16:32:12 2014] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php55/5.5.17/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so' - dlopen(/usr/local/Cellar/php55/5.5.17/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so, 9): image not found in Unknown on line 0
Any ideas on how this happened or where I went wrong? I'm getting discouraged by this OSX development server setup and considering just giving in and installing a dual-booted Ubuntu Partition. I was hoping to leverage OSX's unix base, but it has been a nightmare to setup the dev server so far.
You seem to have messed with homebrew since your PHP is looking for files in Cellar. Run "which php" and check which PHP is actually running and run "php --ini" to make sure you edited the right PHP configuration.
The easiest way to get a proper running PHP is to install it from Homebrew and add that to your PATH.

Homebrew - How to Enable php 5.5

I have installed latest php 5.5.5 and I have no clues how to run it.
Currently I can see integrated php 5.4.17 or so from OS X Mavericks.
I was wondering what should I type in apache file, since none of those from screenshot do not work, except default integrated one by uncommenting first line.
So, can someone please tell me what is the path for newest php that I have installed ? If I type php -v in terminal it will show version 5.5.5 but not on localhost/~dvLden
All you need to type is
$> which php
This worked for me. Note I have a later version of PHP 5.5, which I installed via Homebrew.
LoadModule php5_module /usr/local/Cellar/php55/5.5.9/libexec/apache2/libphp5.so

Categories