How can I resolve Homebrew openssl conflicts? - apache

I am on High Sierra 10.13.6 and I recently ran into an issue with my Homebrew environment for local dev work. I can't seem to figure out what is the problem. Any Composer or Drush commands will give this
dyld: Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib
Referenced from: /usr/local/bin/php
Reason: image not found
Abort trap: 6
I restarted my computer and when I try to start apachectl; I get
httpd: Syntax error on line 179 of /usr/local/etc/httpd/httpd.conf: Cannot load /usr/local/Cellar/php71/7.1.12_23/libexec/apache2/libphp7.so into server: dlopen(/usr/local/Cellar/php71/7.1.12_23/libexec/apache2/libphp7.so, 10): Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib\n Referenced from: /usr/local/Cellar/php71/7.1.12_23/libexec/apache2/libphp7.so\n Reason: image not found
I think this is because the path is looking for openssl, but in the Brew list, I don't have openssl anymore, it is now openssl#1.1
Bash profile has the following:
export PATH="/usr/local/opt/openssl#1.1/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/openssl#1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl#1.1/include"
$which openssl returns
/usr/local/opt/openssl#1.1/bin/openssl
What can I do to resolve this? Maybe I'm missing the obvious.

So in case anyone runs into this. I managed to fix this myself.
First I commented out the following line in my usr/local/etc/httpd/httpd.conf file
LoadModule php7_module /usr/local/Cellar/php71/7.1.12_23/libexec/apache2/libphp7.so
Next I ran
$brew install php#7.3
I added the following lines to .bash_profile
export PATH="/usr/local/opt/php#7.3/bin:$PATH"
export PATH="/usr/local/opt/php#7.3/sbin:$PATH"
Then added the following line to usr/local/etc/httpd/httpd.conf file
LoadModule php7_module /usr/local/Cellar/php#7.3/7.3.13/lib/httpd/modules/libphp7.so
Then I restarted my computer then ran
$brew services start php#7.3
$brew services restart httpd
$sudo apachectl -k restart
Then I had some sql connection issues.
$brew upgrade mariadb
$brew services restart mariadb
$brew services restart httpd
$sudo apachectl -k restart
And everything came together. Hope this helps.

If that helps somebody else not willing to reinstall PHP:
ln -s /usr/local/Cellar/openssl/1.0.2s/lib/libcrypto.1.0.0.dylib /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib
ln -s /usr/local/Cellar/openssl/1.0.2s/lib/libssl.1.0.0.dylib /usr/local/opt/openssl/lib/libssl.1.0.0.dylib

Related

How do I check the apache config for validity in Red Hat Linux?

My operating system is Red Hat Enterprise Linux 7. This isn't working...
# httpd -t
bash: httpd: command not found
In case it helps, this is the command I run to restart apache on this box...
# systemctl restart httpd24-httpd
But this doesn't work...
# httpd24-httpd -t
bash: httpd24-httpd: command not found
This doesn't work either...
# apachectl -t
bash: apachetl: command not found
Nor does this work...
# apachectl configtest
bash: apachetl: command not found
I know this is a couple months old but ended up here. I ran into the same issue initially, hence why I am here. I found that the location for the new httpd24-httpd wasn't in my env path to execute. While I could added it there, I found the command location and was able to execute.
How I found the command:
sudo find / -name apachectl
The output of the command:
/opt/rh/httpd24/root/usr/sbin/apachectl
Executed the command:
sudo /opt/rh/httpd24/root/usr/sbin/apachectl
Turns out I have to fix my configuration.
httpd: Syntax error on line 56 of /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf: Syntax error on line 40 of /opt/rh/httpd24/root/etc/httpd/conf.modules.d/00-base.conf: Cannot load modules/mod_http2.so into server: libnghttp2-httpd24.so.14: cannot open shared object file: No such file or directory
Interesting that this came up for me, as I've not done anything with the configuration in this regard.
Here's the version I am running.
sudo /opt/rh/httpd24/root/usr/sbin/apachectl -v
Server version: Apache/2.4.34 (Red Hat)
Server built: Mar 17 2020 09:34:59
All the best!
Found something more for this as well from an old bug submitted to Redhat
Bug 1329639
Comment 10
scl enable httpd24 -- /opt/rh/httpd24/root/usr/sbin/apachectl configtest

XAMPP apache will not start

I had to reinstall my max with El capitan, and I had XAMPP working with mysql and apache able to start servers. Now my apache server isn't able to start so I can't get to phpmyadmin to do some schoolwork.
I've looked around and saw that it could be a port 80 or 81 issue, so I checked and saw that no applications were currently using the port, either way I still got a no go.
I tried through terminal to see an error message,
Starting XAMPP for Mac OS X 5.6.30-0...
XAMPP: Starting Apache...fail.
XAMPP: Starting diagnose...
XAMPP: Sorry, I've no idea what's going wrong.
XAMPP: Please contact our forum http://www.apachefriends.org/f/
Last 10 lines of "/Applications/XAMPP/xamppfiles/logs/error_log":
tail: /Applications/XAMPP/xamppfiles/logs/error.log: No such file or directory
XAMPP: Starting MySQL...ok.
Contents of "/Applications/XAMPP/xamppfiles/var/proftpd/start.err":
C02L58UUFFT1.corp.proofpoint.com proftpd[1780]: warning: unable to determine IP address of 'C02L58UUFFT1.corp.proofpoint.com'
C02L58UUFFT1.corp.proofpoint.com proftpd[1780]: error: no valid servers configured
C02L58UUFFT1.corp.proofpoint.com proftpd[1780]: Fatal: error processing configuration file '/Applications/XAMPP/xamppfiles/etc/proftpd.conf'
C02L58UUFFT1:~ sblomquist$ lsof -i ':80'
C02L58UUFFT1:~ sblomquist$ lsof -i ':81'
Thought I would post my problem here while I browse around for more possible solutions.
Update your system and install net-tools
On ubuntu, sudo apt update then sudo apt install net-tools -y restart your server

localhost doesn't work on Yosemite

I have just today upgraded to Yosemite. I've not had a mac long. But with the update my localhost doesn't work. Chrome returns This webpage is not available. I've tried
sudo apachectl start to try and get it back but no luck. I'm a new mac user and haven't had to undergo an OS update, so not really sure where to start.
I've stolen the following from
https://github.com/liip/php-osx/issues/75 and http://php-osx.liip.ch/#uninstall
1. reinstall PHP
homebrew helps with this
brew update
brew upgrade
brew uninstall --force php54
brew unlink php54
brew uninstall --force php55
brew unlink php55
rm -rf /usr/local/php5*
brew install php55
2. where is libphp5.so?
please comment out the existing 'LoadModule php5_module' in /private/etc/apache2/httpd.conf and add this
LoadModule php5_module /path/to/lib/libphp5.so
3. delete +php-osx.conf and +entropy-php.conf
delete the files
+php-osx.conf
+entropy-php.conf
in
/etc/apache2/other
4. testing if everything works
try to start apache with
sudo apachectl start
did you try
apachectl configtest
to see if it really is running?
I've just found this:
http://macosx.com/threads/apache-wont-start-up.299851/
-> summary
'Apache couldn't find a certain log file'
cd /private/var/log
sudo mkdir apache2
I'm just upgraded my mac into yosemite, and boom my apache isn't working. i follow the instruction from here, and my localhost is back to normal again, here the simple steps i did.
Open your httpd.conf located on /etc/apache2, please open with sudo like sudo vi httpd.conf (i'm using vim to open the file, for most simple steps)
Find the line with this value LoadModule php5_module libexec/apache2/libphp5.so, you will found it marked with #, so delete the hash (#) and save the file by press ESC => type :wq (command for write and quit)
Restart your apache by using command sudo apachectl restart
See your localhost on browser
*tips:
For fast on searching you can press ESC and then /, and type php5_module => ENTER
You can also remove the mark (hash) fot these line, if you need to enable rewrite_module to activate mod_rewrite and vhost_alias_module for virtual-host on your machine.
*warning
If your MOD_REWRITE still doesn't work, in order to use .htaccess try to check this.
Find the section and change
AllowOverride None to AllowOverride All
Solution in Jan 2016 for El Capitan
None of the other answers worked for me.
run sudo apachectl configtest
I got an error:
AH00526: Syntax error on line 20 of /private/etc/apache2/extra/httpd-mpm.conf: Invalid command 'LockFile', perhaps misspelled or defined by a module not included in the server configuration
That lead me to https://apple.stackexchange.com/questions/211015/el-capitan-apache-error-message-ah00526 and the solution
Edit the file /etc/apache2/extra/httpd-mpm.conf to remove this part:
#
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
#
<IfModule !mpm_winnt_module>
<IfModule !mpm_netware_module>
LockFile "/private/var/log/apache2/accept.lock"
</IfModule>
</IfModule>
I commented that out, rolled back all the other changes(except brew update/upgrade).
My problem here was the httpd.conf file and this line
Include /private/etc/apache2/other/*.conf
Where it tried to load the osx version of PHP I had. I needed to change it to my PHP version
Include /private/etc/apache2/other/php5.conf
Permissions seem to be an issue now however.
I just did:
brew update
brew upgrade
and
sudo apachectl restart
..."It works!"
I ran into this too after upgrading Yosemite recently. Neither localhost nor 127.0.0.1 would resolve. Apparently Yosemite activated or reconfigured a Firewall (System Preferences > Security & Privacy > Firewall [tab]).
I resolved the issue by accessing the Firewall Options and unchecking the box labelled 'Block all incoming connections'. Probably more importantly - that caused the 'Enable stealth mode' option below it to be switched off. That, stealth mode, was likely the culprit.
After saving above changes localhost & 127.0.0.1 worked fine for me again.

install memcache onfedora linux OS

I installed memcache in the following way:
1) yum install memcached
2) yum install php-pecl-memcached
3) Also enabled the 'memcached.so' in php.ini
I tested the memcached in the follwing way:
$mc = new Memcache;
$mc->addServer('localhost', 11211);
echo "Server's version: " . $mc->getVersion() ;
But it generates the following error:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/memcached.so' - /usr/lib64/php/modules/memcached.so: undefined symbol: php_json_encode in Unknown on line 0
PHP Fatal error: Class 'Memcache' not found in /root/memcacheTest.php on line 2
Thank u.
I don't know PHP well (or at all), but from the error message I'll hazzard a guess that you do not have the PHP JSON extension installed, which is apparently needed by the memchached extension.
Apparently, the JSON extension has been in PHP since version 5.2.0, therefore:
You have an older version and you need to upgrade or install the JSON extension yourself
or
Your operating system distributor supplies the PHP JSON extension in a different package that you have not installed.
There is of course the possibility of a misconfiguration, but I think it's slightly less likely.
This showed memcached.so didn't loaded successfully.
Error shows the reason: json.so should be load before memcached.so
Please use php -m | grep memcached to check whether memcached.so is loaded successfully.
If show memcached, this mean it succeeded.
If show like PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/memcached.so' - /usr/lib64/php/modules/memcached.so: undefined symbol: php_json_decode_ex in Unknown on line 0
Here is the solusion:
e.g your php.ini is /etc/php.ini, your php.d is /etc/php.d/
Solution 1
comment 'memcached.so' in php.ini
vim /etc/php.d/memcached.ini
add extension=memcached.so in /memcached.ini
php -m | grep memcached check whether memcached is succeed loaded
Solution 2
rm /etc/php.d/json.ini
add extension=json.so in php.in before extension=memcached.so
php -m | grep memcached check whether memcached is succeed loaded
Can you check and double check user permissions? Additionally, my experience with PHP is that the distribution repository versions of PHP aren't very good. I solved those symbol errors by compiling PHP from the ground up. But that's a very radical and time-consuming solution.
http://pecl.php.net/bugs/bug.php?id=17574&edit=1
Just make sure that extension=json.so is specified BEFORE
extension=memcached.so.
I had placed extension=memcached.so in php.ini, and extension=json.so
was specified in /etc/php.d/json.ini, that is parsed AFTER php.ini.
That is why PHP can't find php_json_encode() at the point of loading
memcached.so.
Also, check that the permissions on memcached.so are the same as the other extensions
Try to install the version 2.0. It helped for me.
yum -y install gcc-c++
wget http://launchpad.net/libmemcached/1.0/0.50/+download/libmemcached-0.50.tar.gz
tar xzf libmemcached-0.50.tar.gz
cd libmemcached-0.50
./configure
make
make install
wget http://pecl.php.net/get/memcached-2.0.0b2.tgz
pecl install memcached-2.0.0b2.tgz
echo 'extension=memcached.so' > /etc/php.d/memcached.ini
service php-fpm restart
cd ..
rm -r libmemcached-0.50*
rm -r memcached-

Apache doesn't start on Snow Leopard using Terminal but works using Web Sharing (System Preferences)

I am using the default Apache installation that comes with Snow Leopard and I have some things installed like MySQL, Rudix (Unix ports and packages) and Xcode.
When I type:
$ sudo apachectl start
I receive this output:
dyld: Symbol not found: _apr_dir_open$INODE64
Referenced from: /usr/local/sbin/httpd
Expected in: /usr/local/lib/libapr-1.0.dylib
in /usr/local/sbin/httpd
/usr/local/sbin/apachectl: line 78: 2023 Trace/BPT trap $HTTPD -k $ARGV
I don't know if it's related but my .bash_profile has this line (I typed it because import MySQLdb was not working in Python):
export DYLD_LIBRARY_PATH="/usr/local/mysql/lib/:$DYLD_LIBRARY_PATH"
If I tick Web Sharing using System Preferences the Apache starts and work, but I wan't to start it using the terminal, maybe I am forgot to pass important arguments to the apachectl command.
The Web Sharing option of System Preferences enables the Apple-supplied Apache. Its apachectl is /usr/sbin/apachectl. You appear to have installed another version of Apache in /usr/local; note the /usr/local/sbin/apachectl path. So you are not using the Apple-supplied Apache installation when you are running from the terminal and the version you are using appears to not have been installed correctly. One way to ensure you are using the Apple-supplied Apache is to specify the full path:
$ sudo /usr/sbin/apachectl start