apache server php version not being update - php

my machine: macOS Sierra 10.12.3
I am currently working on a project that requires some PHP v.>=5.6 features. When I start my virtual php server with XAMPP 1.8.3 and check the php info it tells me the version is 5.5.11.
I tried updating the php version following this tutorial https://jason.pureconcepts.net/2016/09/upgrade-php-mac-os-x/
upon updating my local .bash_profile path and checking php -v I get the upgraded php version PHP 7.1.1 (cli) (built: Feb 13 2017 10:05:49) ( NTS )
But when I check the phpinfo on my apache server run by xampp I still see 5.5.11 I updated the httpd.conf file and commented the old php versions out and implemented the new one, but that doesn't seem to have any effect.
<IfDefine JUSTTOMAKEAPXSHAPPY>
#LoadModule php4_module modules/libphp4.so
#LoadModule php5_module modules/libphp5.so
LoadModule php7_module /usr/local/php5/libphp7.so
</IfDefine>
Any other ideas?
Thank you for your help!

It would be easier to install a new version of XAMPP.
Another solution would be to install Apache/PHP from homebrew.

Are you sure that you update the try apache conf file? It should be in "xampp" directory. Anyway you can just download a new version xampp, e. g. from here https://www.apachefriends.org/ru/download.html

Related

Can't open php file in apache 2.4 Centos 6

I have a server that run Centos 6. Recently I upgrade the php to 7.2 using remi repo and apache 2.4 using the sclo(httpd24).
[user#server1 ~]$ httpd -v
Server version: Apache/2.4.34 (Red Hat)
Server built: May 28 2020 08:47:33
[user#server1 ~]$ php -v
PHP 7.2.33 (cli) (built: Aug 4 2020 10:02:54) ( NTS )
My issue is if i put an phpinfo() in /var/www/html, my browser didn't show anything, and if i open the source i only see the php code.
How do i connect the apache and php together?
Thanks..
Have you made sure that inside the apache server configuration httpd.conf file you are correctly pointing to the php.so file??
You need to make sure the LoadModule php7_module /path/to/the/php#7.2/version/libphp7.so line is in your configuration. If you recently changed the PHP to 7.2 you need to modify the line so it points to the correct php version.
In my case I use the php 7.2, 7.3 and 7.4 versions for different purposes and inside my httpd.conf file i have the following lines:
#LoadModule php7_module /usr/local/opt/php#7.2/lib/httpd/modules/libphp7.so
#LoadModule php7_module /usr/local/opt/php#7.3/lib/httpd/modules/libphp7.so
LoadModule php7_module /usr/local/opt/php#7.4/lib/httpd/modules/libphp7.so
As you can see each version point to a different so file, you need to find the correct one for the 7.2 version and point to it by commenting or uncommenting them depending on the php version.
I upgrade the php to 7.2 using remi
Package in my repository are build against base httpd version 2.2.
You still can use httpd 2.4 (from SCL), but in this case you need to use FPM
Read: PHP Configuration Tips
BTW, as CentOS 6 is close to its end of life (in a few months), I heartily recommend you use a more recent version of CentOS (7 or 8 both have httpd 2.4 by default)

why can't start apache if add PHPIniDir Setting to httpd.conf?

My Server : Win server 2012 64bit, Apache 2.4 64bit, PHP Version 5.6.13 (x64)
After install Apache 2.4, i can start normal.
But If i add PHP to httpd.conf
PHPIniDir "C:\php"
LoadModule php5_module "C:\php\php5apache2_4.dll"
I can't start apache, it show message:
Windows could not start the Apache2.4 on Local Computer. For more information, review the System Event Log. If this is a non-Microsoft service, contact the service vendor, and refer to service-specific error code 1.
why can't start apache if add PHPIniDir Setting to httpd.conf?
I test on Win 7, it is ok.
The cause : my php using php_com_net.dll
So i have to install: MSVC11 (Visual C++ 2012)

cannot update PHP on mac osx 10.9

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.

Two versions of php in El Capitan. How do I get rid of one or upgrade the other?

In terminal,
php -v
gives
PHP 5.3.29 (cli) (built: Sep 28 2015 06:33:13)
(with imagick installed) but, in the browser (using apache)
phpinfo();
gives
PHP Version 5.5.27
(with no imagick installed) How do I resolve this?
I don't want to mess about with php.ini and httpd.conf when I'm not entirely sure what I'm doing!
Solved it. I entered
locate libphp5.so
into terminal to find paths to the php installations. This outputted
/usr/libexec/apache2/libphp5.so
/usr/local/Cellar/php53/5.3.29_4/libexec/apache2/libphp5.so
I then edited the apache configuration file
sudo nano /private/etc/apache2/httpd.conf
and changed
LoadModule php5_module libexec/apache2/libphp5.so
to
LoadModule php5_module /usr/local/Cellar/php53/5.3.29_4/libexec/apache2/libphp5.so
NOTE : This line will be different for your local installation, copy the value outputted from the locate command above
I then restarted apache with:
sudo apachectl graceful
Credit to this solution for the command to find the php installations
This may be a help to you : Upgrade to PHP 5.4 on MAC and remove version 5.3.10
I would suggest that you work in a virtual setup instead.
like Vagrant: https://www.vagrantup.com/
Also take a look at Homestead: http://laravel.com/docs/4.2/homestead
"Laravel Homestead is an official, pre-packaged Vagrant "box" that provides you a wonderful development environment without requiring you to install PHP, HHVM, a web server, and any other server software on your local machine.
"
It will also allow you to keep your configuration if you change machine and/or operating system.

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?

Categories