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
Related
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.
I have installed php7.2 using homebrew. But when i run php -v i still get php7.1. Of which i think it wasn't installed with Homebrew. How can i enable disable 7.1 and enable 7.2.
I have tried this as suggested by the install.
To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php7_module /usr/local/opt/php#7.2/lib/httpd/modules/libphp7.so
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
Finally, check DirectoryIndex includes index.php
DirectoryIndex index.php index.html
Also tried, uncommenting this line in /etc/apache2/httpd.conf
LoadModule php7_module libexec/apache2/libphp7.so
I have solved this by linking the new installed version.
After installing the new php version(7.2) with homebrew, you have to run
brew link php#72 --force
if your previous version was a installed with homebrew, you have to unlink it also. E.g for php 7.1
brew unlink php71
This is for the php CLI(command line), for the Apache PHP you need to edit /etc/apache2/httpd.conf
When you run php -v, you get the version of PHP that is executed from the command line, not the version of PHP executed from Apache.
If you run:
/usr/local/bin/php -version
You will have the version of the PHP installed by Homebrew. To set it as the default PHP interpreter from the command line, your PATH environment variable should contain /usr/local/bin/ before /usr/bin.
To check the version of PHP executed within Apache run phpinfo by browsing the following PHP file:
<?php
phpinfo();
I downloaded and installed php 5.6 from php-osx.liip.ch and also edited the path to /usr/local/bin in /.bash_profile.
I am getting php version 5.6.19 in terminal, but when I execute phpinfo(); I still see the previous 5.4 version
also the php info shows that the php.ini lies in /etc directory
how can I solve this?
Although this is 3 months old, this just happened to me yesterday with the same installer (php-osx.liip.ch), so here's my solution.
In my case, the apache configuration (httpd.conf) was pointing to the old php extension:
LoadModule php5_module libexec/apache2/libphp5.so
When it should be this:
LoadModule php5_module /usr/local/php5/libphp5.so
Your path should be the same as mine. My httpd.conf is on /private/etc/apache2/httpd.conf
After editing httpd, restart apache and phpinfo() should return the correct version.
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.
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