Apache not working after macOS Catalina update - php

Every time macOS is upgraded to a new major version then php, apache or mysql stops working. This happens again with Catalina too. I faced issue in starting apache and mysql. Mysql started to fail as
[ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!

I am posting the solution I performed for starting mysql as well as apache, php on macOS Catalina.
First, I have gone through the steps which I have shared earlier for Mojave.
Apache not working after macOS Mojave update
As I am using PHP 5.6 so I needed libphp5.so to make PHP 5.6 work after macOS upgrade. As before installing catalina, apache/php/mysql was working fine so I have the library already alavailable. I found the .so file using below command and updated the same in "/etc/apache2/httpd.conf"
sudo find / -name libphp5.so
after finding the file, I updated the same with path in /etc/apache2/httpd.conf
LoadModule php5_module
/usr/local/Cellar/php#5.6/5.6.25_1/libexec/apache2/libphp5.so
This makes the PHP 5.6 working but still mysql was failing with below error.
"[ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!"
As it is my development area only so I simply did following:
1. goto the mysql installation bin directory
cd /usr/local/mysql-5.6.25-osx10.8-x86_64/bin
run the mysql with root as user.
sudo ./mysqld --user=root
it started the mysql too.

Related

Your PHP installation appears to be missing MYSQL extension which is required by wordpress for redhat

I have been struggling with this error for quite sometimes and I am wondering if someone could help me get this running
I have
php -v 7.2.24
mysql -v 8.0.21
Apache 2.4.37
redhat 8.4
it keeps giving me the same error, I have removed and reinstalled php or mysql but didnt solve the issue. I also found other posts and i let the php.ini to have extension=mysqli still the same error.
I tried to have a index.php to the DNS and it shows that there is not any mysql section
any idea?
Probably, you need to install the MySQL extension for PHP:
# yum install php-mysql
Then restart Apache
# service httpd restart

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

PHP stopped working after MacOS update to High Sierra

I recently upgraded to High-Sierra and now my local server won't run PHP (code shows it as text)
To try and solve the issue I removed all php versions with homebrew and installed php 7.2 using homebrew. But the issue remains.
I don't see any error in the local server log files.
P.S.
I do not see attempted to add
LoadModule php7_module /usr/local/opt/php72/libexec/apache2/libphp7.so
But the path seems to be wrong since I get an error..
Turns out I had to reinstall XCode Command Line Tools and this solved the issue

PHP upgrade issues

I am running a MacBook Air with macOS Sierra 10.12.3. I upgraded my PHP from 5.x to 7.1.1 according to this site and now I am having two issues:
a) The PHP process startup takes around 7 seconds, even for a php -v to print PHP's version. edit: Solved.
b) Apache does not serve my pages anymore locally. Chrome just shows the generic error page with "ERR_CONNECTION_REFUSED". I have restarted the apache service but don't really know what else to do. The apache vhosts config file worked before and still looks good. edit: Also nothing in the apache error logs.
edit: The syslog shows
(org.apache.httpd[71685]): Service exited due to signal: Segmentation fault: 11 sent by exc handler[0]
(org.apache.httpd): Service only ran for 5 seconds. Pushing respawn out by 5 seconds
Does anyone know how to fix this?
Solved it now.
The issue with Apache was that an additional config file in /etc/apache2/other/+php-osx.conf was created that loaded the php7.1 module, but the module loading of php5 in /etc/apache2/httpd.conf was not disabled.
Loading both obviously crashed apache and commenting out the LoadModule in httpd.conf solved it. I have no idea why the installation routine didn't do that though.
Thank you all for helping me.
https://php-osx.liip.ch is a pretty good site, I used to use it before to upgrade my php installations. I found that time to time it would be untrust worthy and sometimes brick my installation. Edit The scripts used on that site usually compile PHP when ran and this can lead to some interesting quirks and inconsistencies. So I switched to using brew.
Brew is a handy tool for Mac that works a lot like apt-get or yum. I would recommend you try this, it adds libraries in a way that allow you to purge them from your machine and reverting to older versions.
$ brew search php71
# lists all the matches for php71, you will find "homebrew/php/php71"
$ brew install homebrew/php/php71
# installs php71, it will give you some good instructions if there are errors
# typically some permission errors, but it gives commands to run too
$ brew link homebrew/php/php71
# overrides the local php command with "homebrew/php/php71"
$ php -v
PHP 7.1.1 (cli) ...
Then I would suggest looking at PHP Local Server that is built in if its still not working. Although I am 99% sure your issues will be resolved.
In future upgrading your php version is as simple as doing the above again where php71 is your new version (example php72 for 7.2). Removing your old version is easy, although does no harm and does allow you to quickly switch your versions around with a single command line option.

php artisan migrate : PDOException could not find driver

I was in need to install Php 5.6 with postgres. I followed the instructions from here and did:
brew install php56 --without-mysql --without-apache --with-postgresql
brew install php56-pdo-pgsql
Php 5.6 and postgres are running fine with my Projects using PostgreSQL.
Now there is some problem with Laravel projects using mysql. On running php artisan migrate command, it shows:
[PDOException]
could not find driver
Project works fine in the browser though. Data is being fetched perfectly from the mysql tables. php -m also does not shows mysql. But phpinfo does shows mysql module.
What could be the problem? Do i need to reinstall mysql?
Probably, you would need to activate mysql extension in php
Find your php.ini. Create a php file with following content and run it. It will tell you where it is.
<?php phpinfo(); ?>
Just look at the path of loaded configuration file. Common places include /etc/apache/, /etc/php4/apache2/php.ini, /etc/php5/apache2/php.ini or even /usr/local/lib/php.ini for Windows it may be C:\Users\username\PHP\php.ini
Edit your server’s php.ini and look for the following line. Remove the ‘;’ from the start of the line and restart Apache. Things should work fine now!
;extension=mysql.so
should become
extension=mysql.so
For windows it will be
;extension=mysql.dll
should become
extension=mysql.dll
Restart your apache service to load the new configuration.

Categories