I am using mac 10.8 and I have installed php 5.5. At command line php -v show version 5.5. but when I starts mac's apache server with phpinfo(), it show version 5.4.
Can anyone please help me how to make apache to use version 5.5
Thanks
find out the conf/httpd.conf and conf.d/*.conf
find the tag like this: LoadModule php5_module modules/libphp5.so
make the change to correct php installation folder like this:
LoadModule php5_module /usr/local/Cellar/php54/5.4.8/libexec/apache2/libphp5.so
This will change your php model (php version) in Apache
Search on your local desk: find / -name "libphp5.so"
Regarding the correct so file: libphp5.so not being created after compiling and prefix directory not created
[update]
http://www.howtoforge.com/centos-5.6-php53-common-conflicts-with-php-common
1) update yum to include latest php
2)
For 64bit systems, you can find the correct packages here: http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/
For 32bit systems, the correct packages are here: http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/
3)
(replace to the correct URL and file name which you want to have, check it from step "2)")
rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/epel-release-5-4.noarch.rpm
rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/i386/ius-release-1.0-11.ius.el5.noarch.rpm
4) rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
rpm --import /etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY
5) yum install yum-plugin-replace
6)
You can now replace your PHP old version packages with the PHP new version packages from IUS like this:
yum replace php --replace-with php55w
You can search for further php55w packages like this:
yum search php53u
If you uncommented the line LoadModule php5_module /usr/local/php5/libphp5.so in httpd.conf comment it again, then add the line export PATH=~/bin:/usr/local/php5/bin:$PATH in .bash_profile
This did the trick for me. Note: i have installed php5.5.5 via liip on OS X Mavericks
Related
On my mac I've got php installed and working fine. I recently wanted to install mcrypt, so I did so using brew. Although it seemed to install fine, it doesn't show up in my phpinfo(). So I think that the php that brew installed mcrypt in, isn't the php that apache uses.
Does anybody know how I can:
check whether there is a difference between the php installed by brew and the php which Apache uses?
make apache use the php that brew installed?
All tips are welcome!
According to the contributors of the Homebrew php formula...
The contributors of the Homebrew php formula give the following instructions. The exact instructions reproduced here install php7.4. Substitute the php version you need.
(Avoid "special" ways of accomplishing your objective; they are often problematic. "Official" approaches are more likely to give you a predictable, maintainable setup.)
$ brew search php // since php can be installed by homebrew but be missing from your PATH, review the list of php versions available through homebrew; a checkmark next to a version indicates one is installed
$ brew install php#7.4
$ echo 'export PATH="/usr/local/opt/php#7.4/bin:$PATH"' >> ~/.zshrc // add the alias to your path (issues you are using zsh, the default now for macOS); see comments output during installation
$ source ~/.zshrc // reload . zshrc to use the new settings immediately
The contributors of the formula also provide the following instructions for enabling PHP in Apache:
To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php_module /usr/local/opt/php/lib/httpd/modules/libphp.so
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>`
Finally, check DirectoryIndex includes index.php
DirectoryIndex index.php index.html
The php.ini and php-fpm.ini file can be found in:
/usr/local/etc/php/7.4/
These instructions for enabling PHP in Apache appear in stdout when you install php. Alternatively in Terminal use brew info php or visit the Homebrew PHP formula page
You have to make your Apache use the PHP that you just downloaded.
Open your httpd.conf (mine is at /etc/apache2/httpd.conf) and look for the line that loads the PHP module, something like:
LoadModule php5_module path/to/php
Then, make it point to the PHP that brew installed for you with mcrypt support. Mine was at this path. Yours can vary depending on the PHP version that you installed.
/usr/local/Cellar/php54/5.4.21/libexec/apache2/libphp5.so
Finally you will need to restart your Apache server to load the new configuration:
sudo apachectl restart
Can't comment on stackoverflow yet due to my lack of experience but to add to the above answer is correct. Just an additional comment to find the correct path:
run:
brew info php54
or which ever version u have installed and it will show you the path:
To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php5_module /usr/local/opt/php54/libexec/apache2/libphp5.so
brew install php installs php 7.3 at the moment, versions below are keg-only
You can make aliases for versions below by adding this to:
~/.profile
alias php#5.6='$(brew --prefix php#5.6)/bin/php'
alias php#7.0='$(brew --prefix php#7.0)/bin/php'
alias php#7.1='$(brew --prefix php#7.1)/bin/php'
alias php#7.2='$(brew --prefix php#7.2)/bin/php'
~/.bashrc
source ~/.profile
~/.zshrc
[[ -e ~/.profile ]] && emulate sh -c 'source ~/.profile'
Then you can:
php#5.6 -v
php#7.0 -v
php#7.1 -v
php#7.2 -v
If you use composer and the platform php is not set in your project then this can be handy:
~/.profile
alias composer#5.6='php#5.6 $(which composer)'
alias composer#7.0='php#7.0 $(which composer)'
alias composer#7.1='php#7.1 $(which composer)'
alias composer#7.2='php#7.2 $(which composer)'
If you use artisan a lot (artisan maps to php which is 7.3) then this can be handy:
~/.profile
alias artisan#5.6='php#5.6 artisan'
alias artisan#7.0='php#7.0 artisan'
alias artisan#7.1='php#7.1 artisan'
alias artisan#7.2='php#7.2 artisan'
I would create an alias to it so you don't disturb the system PHP install.
brew info php71
Brew installs into /usr/local/Cellar so you can add the following to your ~/.bash_alias or ~/.profile.
alias php7='/usr/local/Cellar/php71/7.1.10_21/bin/php'
Try: brew link php71 --force to use brew specific php version.
It worked for me.
As of 2021, all you need is
brew install php
then
brew link php
This will give you php 8.0 and setup your symlinks.
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.
Dumb question I think, but I have PHP 5.6.14 running on El Capitan.
I have installed xdebug with
brew install php56-xdebug
But there is no mention of xdebug in phpinfo
phpinfo reveals:
Configuration File (php.ini) Path: /etc
When I run brew install php56-xdebug again, I get
homebrew/php/php56-xdebug-2.3.3 already installed
So I'm guessing that brew has installed xdebug on a path (where?) which is for a different version of PHP which I'm not actually running.
Can somebody help me understand what brew has done, and how I can configure the version of PHP that I'm running to include xdebug.
OK, so I fixed this. Any comments welcome on whether I did it right.
1) Found where the brew install of php is using
brew info php56
This reports:
To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php5_module /usr/local/opt/php56/libexec/apache2/libphp5.so
Update version of php loaded by apache:
sudo nano /etc/apache2/httpd.conf
Replaced
LoadModule php5_module libexec/apache2/libphp5.so
with
LoadModule php5_module /usr/local/opt/php56/libexec/apache2/libphp5.so
For those who use different version of php type in terminal
--> brew search xdebug
and choose yours version.
after installing your version of xdebug you've to active it by placing the installed extension path to your php.ini file.
print your phpinfo() and look for "Loaded Configuration File".
Open the file shown for "Loaded Configuration File" ( mine is /etc/php.ini ) and paste extension path anywhere you like.
for me the xdebug installed extension path is "/usr/local/Cellar/php56-xdebug/2.5.1/xdebug.so"
so i pasted {zend_extension="/usr/local/Cellar/php56-xdebug/2.5.1/xdebug.so"}.
restart your apache server and check your phpinfo() for xdebug, thats all.
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
I installed Homebrew and decided to upgrade php version to 5.5. Make it through the command:
brew install php55
All went well, and then I ordered a .bash_profile:
export PATH="$(brew --prefix homebrew/php/php55)/bin:/usr/local/bin:$PATH"
Next in the directory /Library/WebServer/Documents/ I created info.php file:
<?php phpinfo(); ?>
And opened it through the browser, but display the old version of php 5.4.30. How to enable php5.5 or delete old version php5.4.30? Help me!
I solved the problem, in the Apache configuration file nttpd.conf was need to set the path to the new version of php:
#LoadModule php5_module libexec/apache2/libphp5.so
LoadModule php5_module /usr/local/Cellar/php55/5.5.19/libexec/apache2/libphp5.so