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.
Related
I am currently running php 7.3 on MacOs 10.15
Since I want to upgrade to 7.4 I tried to do it with Homebrew. Everything works fine and after updating the path if I run php -v I see the 7.4 version.
I tried to update apache also but here I have the issue.
I changed this line:
LoadModule php7_module libexec/apache2/libphp7.so
to this one
LoadModule php7_module /usr/local/opt/php#7.4/lib/httpd/modules/libphp7.so
but now apache will not start again. The path is fine, apachectl configtest complains about that line I have edited but doesn't provide any meaningful information on what is wrong.
Did anyonwe face the same already? What can be the cause?
I am trying to use pgsql extension on Windows 10 64-bit (WAPP).
I have:
restarted Apache
uncommented all postgresql extensions in php.ini
used LoadFile to load pgsql.dll
moved pgsql.dll to Apache bin (I tried both dll from php folder and from postgresql)
But still no result.
pgsql is visible only in php.exe -m but not in phpinfo(), extension_loaded(), get_loaded_extensions().
My php version is 7.1.8 and PostgreSQL is 9.6 and Apache is 2.4.27.
My php.exe -m output:
What can be the problem?
[SOLVED]
Okay, after a few hours of looking, I found the problem and was able to solve the problem with the pdo_pgsql and pgsql modules not showing in phpinfo().
[SOLUTION]
After uncommenting the extensions in php.ini, go into httpd.conf and add at the top of all the LoadModule lines the following:
LoadFile "C:/Program Files/PostgreSQL/9.6/bin/libpq.dll"
(assuming you are using the latest version of PostgreSQL, otherwise change the number to the version you are using).
Save and restart Apache. Go to phpinfo() and you will see it is loaded.
[REASON]
Apache is unable to see the libpg.dll even if you copy it into the Apache/bin folder.
[ENVIRONMENT]
Windows Server 2016 (works for Windows 10 as well)
Apache 2.4.26
(x64) PHP 7.1.8 (x64 ThreadSafe VC14)
PostgreSQL 9.6.4 (x64)
Usually, command line PHP does not share the configuration file with Apache or in other words, the Apache php.ini is a different one then the one you edited.
Use phpinfo() running through apache and search for php.ini to locate the configuration file that was loaded.
The accepted solution also works for the latest version of PHP 7, namely 7.3.5 on Windows 10 environment.
The inclusion of the LoadFile directive atop all the LoadModule directives simply works fine. I too was struggling for the solution. It appears that there is some issue on the said environment that the libpq.dll doesn't get loaded by default. The solution is awesome.
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
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
i'm your average college student interested in using PHP. Could anyone give me a 101 on how to install/enable it on a mac version 10.7.2 using simple, plain language? I will appreciate any and all help!!
Cheers
No Need to Install PHP or Apache, They already ship with Mac 10.7
These are the basic steps you need to take for PHP and Apache to work together:
Enable PHP in you httpd.conf file located - /etc/apache2/httpd.conf
Setup your php.ini - sudo cp /etc/php.ini.default /etc/php.ini
Enable the Apache web server located in the Sharing > Web Sharing
Enable PHP in Apache
Find this setting in your httpd.conf file
#LoadModule php5_module libexec/apache2/libphp5.so
And, uncomment it like
LoadModule php5_module libexec/apache2/libphp5.so
This guide explains setting up MySQL and VirtualHost on Mac. I have been using this setup for over six months. Also, worked on the 10.7 early releases just fine.
http://superfancy.net/coding/php-mysql-apache-in-mac-osx-leopard/
Shell Commands to Start and Stop Apache on Mac
Start Apache
sudo apachectl start
Restart Apache
sudo apachectl restart
(edited to remove typo in restart command)
PHP5 should be already installed, it's just disabled. Open the Apache config file with a text editor it's at
/private/etc/apache2/httpd.conf
Now find the line which reads: "#LoadModule php5_module libexec/apache2/libphp5.so" and delete the comment (hash) from the beginning of the line and save the file (you'll need admin permissions to do this)
Now restart Apache - from the Terminal app type: sudo apachectl graceful
It will ask for your admin password
PHP should now be working..