OS X 10.10 - apache will not run PHP from homebrew - php

I have installed php55 with homebrew to get postgresql support and linked the php module in apache.
LoadModule php5_module /usr/local/opt/php55/libexec/apache2/libphp5.so
Still my phpinfo() - shows PHP 5.5.20 (the built in OS X). But from terminal I get PHP 5.5.26.
What can I do to fix this and force apache to use PHP 5.5.26?

I solved this. I solved this with removing PHP55 (brew uninstall php55 and related php pdo_psql) and reinstalling (brew install php55 --with-postgresql) since I needed postgresql support. I then made sure apache was stopped and started it again. I needed to edit the php.ini file that is now at
/usr/local/etc/php/5.5/php.ini
Everything seems fine now and using the new PHP55 I installed with homebrew.

Related

mcrypt is not installed with the php 5.6

I have installed the php version 5.6 and in order to run my laravel application it is asking to install and enable the mcrypt extension. These are the steps I followed.
brew install php56 php56-mcrypt
nano /etc/apache2/httpd.conf
Then editing the httpd.conf file I added the following.
LoadModule php5_module /usr/local/opt/php56/libexec/apache2/libphp5.so
But when I run the following command in order to check the "mcrypt" availability still it shows that it is not installed.
php -i | grep "mcrypt"
I made it working on mac or windows using the Xampp that uses php 5.6 and my issue with the mcrypt is gone.

How to configure PHP Intl extension on MacOS Mojave? [duplicate]

I followed a guide which used home-brew to install the lastest version of php (5.4.8) on OSX Mountain Lion.
I then followed a guide which showed me how to setup and use the pre-installed apache on OSX.
However when I try running up a base Symfony 2 project I get a bunch of errors relating to missing date.timezone in the php.ini.
However I have this correctly setup the php.ini but doing a quick phpinfo() in the Symfony project shows that its using the old preinstalled version of php (5.3) rather than the new one.
In terminal if I type which php & php -v, It shows the correct new version is being used.
But the phpinfo() shows
Did you follow all the instructions provided in the Caveats?
Run brew info php54 to see them again.
Especially the line:
To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php5_module /usr/local/Cellar/php54/5.4.8/libexec/apache2/libphp5.so
Apache is not aware of the homebrew version of PHP (i.e. /usr/bin/php). You see it on the command line because you've likely modified your PATH (i.e. /usr/local/bin/php).
You can modify this in your httpd.conf file.
I am not a fan of homebrew or other package libraries. Primarily because Mac OS X is built atop Unix. Furthermore, all but MySQL are installed natively. Here's an article on installing Apache, MySQL, and PHP on Mac OS X.
Disclaimer: I wrote that article.
Today I have same issue for updating php 7.2 to 7.3 as requirement of Laravel 6. Here is my solution.
Open your httpd.conf file in "/etc/apache2/http.conf"
Search (Ctrl + w) for "LoadModule php"
Uncomment that row
Restart your apache with "sudo apachectl restart"
Then, your php version in local web server (apache2) will be updated

memcache won't appear php with osx homebrew

I have php project I want to develop in osx and I have used memcache
I have implemented in linux but when I try to migrate to osx i can't find memcache
I have tried to install it with brew or pecl doesn't work
I have tried xampp as well and doesn't work
Sure I have done
sudo apachectl restart
added memcache.co to php.ini
I use php 5.6 and php 7.0 and just note I use memcache not memcached
It should be installed with PECL:
pecl install memcache
locate the php.ini file:
php --ini
then edit the php.ini file and add the complete path to memcache.so (as shown at the end of the installation output)

Changing php version on apache (using XAMPP) using homebrew on a mac, httpd change ignored?

I installed php 5.4 using homebrew, and verified version 5.4 via terminal php -v.
I commented out the previously used load modules for php4/5, and inputted the suggested line in httpd.conf for apache:
LoadModule php5_module /usr/local/opt/php54/libexec/apache2/libphp5.so
But my localhost is still using php5.6.11 according to phpversion().
I am on a mac running Yosemite.
Any ideas?

Can't load installed PHP version in Apache (Homebrew OS X)

Ok there was question like that but situation was different - I want to use build - in OS-X Apache (2.4) and PHP installed by Homebrew (5.6).
So I put this is httpd.conf
LoadModule php5_module /usr/local/opt/php56/libexec/apache2/libphp5.so
And when i restart Apache I get this
httpd: Syntax error on line 118 of /usr/local/etc/apache2/2.2/httpd.conf: Cannot load /usr/local/opt/php56/libexec/apache2/libphp5.so into server: dlopen(/usr/local/opt/php56/libexec/apache2/libphp5.so, 10): Symbol not found: _ap_unixd_config\n Referenced from: /usr/local/opt/php56/libexec/apache2/libphp5.so\n Expected in: /usr/local/Cellar/httpd22/2.2.29/bin/httpd\n in /usr/local/opt/php56/libexec/apache2/libphp5.so
Also First I have installed apache2.2 by homebrew as well. But I decided to remove it and used build-in one. But despite that I removed this in homebrew it is still there. So I have two apache and I am not really sure how to remove 2.2 version.
Can you please help me with these? I tried everything my knowledge allows me to do, so please let me seek yours
If apache can't find libphp5.so there is no libphp5.so on given path.
uninstall php56: brew uninstall php56
install php56 again with Apache option: brew install php56 --with-apache
At the end of installation you can look at summary of installation (last line of terminal output) to find out where libphp5.so is installed (im my case in /usr/local/Cellar/php56/5.6.32_8).
Now you should find libphp5.so in /usr/local/Cellar/php56/5.6.32_8/libexec/apache2

Categories