Unable to connect to server following phpMyAdmin upgrade from 5.1 to 5.2 - linux

Working environment:
OpenSUSE Leap 15.4
MariaDB : mariadb Ver 15.1 Distrib 10.7.7-MariaDB
PHP 8.0.25 (cli) (built: Oct 31 2022 12:00:00) ( NTS )
Based on phpinfo(), PHP ini file is: /etc/php8/cli/php.ini.
phpMyAdmin 5.1 is working well. Installation directory is: /usr/share/phpMyAdmin (default directory created when installing via zypper install phpMyAdmin command).
The "famous" option $cfg['Servers'][$i]['host'] from /etc/phpMyAdmin/config.inc.php file is set to localhost (and it does work!).
I have then upgraded phpMyAdmin version this way:
srv-bla:~ # mv /usr/share/phpMyAdmin /usr/share/phpMyAdmin.old
srv-bla:~ # mkdir /usr/share/phpMyAdmin
srv-bla:~ # wget https://files.phpmyadmin.net/phpMyAdmin/5.2.0/phpMyAdmin-5.2.0-all-languages.tar.gz
srv-bla:~ # tar -xzf phpMyAdmin-5.2.0-all-languages.tar.gz
srv-bla:~ # mv phpMyAdmin-5.2.0-all-languages/* /usr/share/phpMyAdmin/
I then restart daemons and test the connection:
srv-bla:~ # systemctl restart mysqld mariadb apache2
The connection page is showing right. I then enter my credentials and I get stuck with this bloody message:
Impossible to connect to server.
mysqli::real_connect(): (HY000/2002): No such file or directory
I have wandered for a while on numerous webpages. Many of them suggest to modify the config.inc.php file and to set $cfg['Servers'][$i]['host'] option to 127.0.0.1 instead of localhost. Unfortunately, this does not fix the problem for me...
Am I editing the right config.inc.php file? Actually, I can find only one on the server:
srv-bla:~ # updatedb
srv-bla:~ # locate config.inc.php
/etc/phpMyAdmin/config.inc.php
/etc/phpMyAdmin/config.inc.php.rpmnew
/etc/phpMyAdmin/config.inc.php.rpmsave
Apache logs are not friendly either. Access logs returns 200 codes only, which seems normal to me (the phpMyAdmin webpage is served properly). Error logs are empty...
Mysql logs are empty also (/var/log/mysql/mysqld.log).
Or course, I have check that mysqld service (same as mariadb service) is running.
The socket file from MariaDB point of view is:
srv-bla:~ # mariadb -u root -p
Enter password:
MariaDB [(none)]> \s
[...]
UNIX socket: /var/lib/mysql/mysql.sock
[...]
The php.ini file is configured the same way:
srv-bla:~ # cat /etc/php8/cli/php.ini | grep mysqli.default_socket
mysqli.default_socket = /var/lib/mysql/mysql.sock
To me, there is no socket issue...

You were right #Georg Richter!
Solution for me:
The PHP configuration file returned by php -r 'phpinfo();' command in a terminal is /etc/php8/cli/php.ini.
The PHP configuration file returned by the phpinfo() function called with a URL such as http://myserver.fr/phpinfo.php is /etc/php8/apache2/php.ini.
I modified the line mysqli.default_socket = /var/lib/mysql/mysql.sock in this other configuration file and could call again phpMyAdmin with success. Note that emtying the browser cache was necessary!
Thanks for help, and hope this will help others!

Related

What configuration settings need to be done to fix Apache - MongoDB connectivity issues caused by SE Linux?

I have Apache 2.4 running on CentOS 7. SE Linux is enabled. The application uses Laravel (Lumen), and connects to MongoDB on another server. All our servers are in Google cloud.The applications fails to load the web page and lumen.log has errors like this lumen.ERROR: MongoDB\Driver\Exception\ConnectionTimeoutException: No suitable servers found (serverSelectionTryOnceset): [Failed to resolve 'mongo.***.***'] in /var/www/***/vendor/mongodb/mongodb/src/Collection.php:612
If SE Linux is disabled, it works. I have the following sebools set
httpd_can_network_connect --> on
httpd_can_network_connect_db --> on
httpd_can_network_relay --> on
Anything else to be set? How to troubleshoot this?
I installed setroubleshoot and setools using
yum install setroubleshoot setools
and used it to analyze audit.log.
sealert -a /var/log/audit/audit.log
It turned out that apache was not able to read /etc/hosts and go to MongoDB server.
ls -lZ /etc/hosts
-rw-r--r--. root root system_u:object_r:unlabeled_t:s0 /etc/hosts
Executing
restorecon /etc/hosts
Changed it to
-rw-r--r--. root root system_u:object_r:net_conf_t:s0 /etc/hosts
and fixed the issue.

Installing Apache on Windows Subsystem for Linux

Having just updated to the newest Windows 10 release (build 14316), I immediately started playing with WSL, the Windows Subsystem for Linux, which is supposed to run an Ubuntu installation on Windows.
Maybe I'm trying the impossible by trying to install Apache on it, but then someone please explain me why this won't be possible.
At any rate, during installation (sudo apt-get install apache2), I received the following error messages after the dependencies were downloaded and installed correctly:
initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: No such file or directory
runlevel:/var/run/utmp: No such file or directory
* Starting web server apache2 *
* The apache2 configtest failed.
Output of config test was:
mktemp: failed to create directory via template '/var/lock/apache2.XXXXXXXXXX': No such file or directory
chmod: missing operand after '755'
Try 'chmod --help' for more information.
invoke-rc.d: initscript apache2, action "start" failed.
Setting up ssl-cert (1.0.33) ...
Processing triggers for libc-bin (2.19-0ubuntu6.7) ...
Processing triggers for ureadahead (0.100.0-16) ...
Processing triggers for ufw (0.34~rc-0ubuntu2) ...
WARN: / is group writable!
Now, I understand that there seem to be some folders and files missing for Apache2 to work. Before I start changing anything that will mess with my Windows installation, I want to ask whether there's a different way? Also, should I worry about / being group writable or is this just standard Windows behaviour?
In order to eliminate this warning
Invalid argument: AH00076: Failed to enable APR_TCP_DEFER_ACCEP
Add this to the end of /etc/apache2/apache2.conf
AcceptFilter http none
Note the following in your output
failed to create directory via template '/var/lock/apache2.XXXXXXXXXX': No such file
I tried listing /var/lock. It points to /run/lock, which doesn't exist.
Create the directory with
mkdir -p /run/lock
The install should now work (you may need to clean the installation first)
You have to start bash.exe in administrator mode to avoid a lot of problems related to network.
i installed Lamp (Apache/MySQL/Php) without any problem :
Start bash.exe in administrator mode
type : sudo apt-get install lamp-server^
add these 2 lines in /etc/apache2/apache2.conf :
Servername localhost
AcceptFilter http none
then you can start apache :
/etc/init.d/apache2 start
Following the great advice here I edited apache2.conf and inserted the following to end of file after receiving all the various errors above and apache2 then worked great on the debian wsl package:
Servername localhost
AcceptFilter http none
AcceptFilter https none

Web browser not displaying the index.html in the htdocs directory - Apache

The installation path of my Apache web server is /usr/local/apache2.
I start the server using a apachectl start command and when i type localhost in my Web Browser it displays a Apache 2 Test Page powered by CentOS and not the index.html in /usr/local/apache2/htdocs. Does any one know the reason for this?
Also there are two conf.d files in my system. One is in /etc/httpd/conf and other one is in /usr/local/apache2/conf (where i installed Apache). Any reasons for this? Please help
Firstly, I'm guessing you have built apache from source - was there a specific reason for doing this? I usually find systems are a lot more manageable if you use the standard distribution packages or use new packages from other repos if you need later versions.
If you don't have a specific need for using locally-built apache, I'd recommend removing it then installing apache using the normal CentOS repositories.
Next (or first, if you are staying with the locally-built apache), run: httpd -V
For example, one of my systems returns:
[me#here ~]# httpd -V
Server version: Apache/2.2.3
Server built: Jun 6 2012 10:00:36
Server's Module Magic Number: 20051115:3
Server loaded: APR 1.2.7, APR-Util 1.2.7
Compiled using: APR 1.2.7, APR-Util 1.2.7
Architecture: 32-bit
Server MPM: Prefork
threaded: no
forked: yes (variable process count)
Server compiled with....
-D APACHE_MPM_DIR="server/mpm/prefork"
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=128
-D HTTPD_ROOT="/etc/httpd"
-D SUEXEC_BIN="/usr/sbin/suexec"
-D DEFAULT_PIDLOG="run/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_LOCKFILE="logs/accept.lock"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd.conf"
The output will tell you where its true config file is, in this case /etc/httpd/conf/httpd.conf - that way you'll know which config is the one actually being used.
Once you know which config files are being used, you can check them to see where the document root is - it might be in /var/www/html/ instead of /usr/local/apache2/htdocs or just about anywhere.
When you know where the document root is, then check and make sure the files and directories are readable by apache (or whatever user apache is running as - the first column from ps aux | grep httpd will tell you that)
Next check the logfiles, typically /var/log/httpd/error_log and also the system logs in /var/log/messages and /var/log/secure
Lastly, if you are running a recent CentOS which has SELinux enabled, and you have built apache yourself you'll almost certainly be in a world of pain. You can try getenforce to see if SELinux is active, and setenforce 0 to disable it (for testing).

Varnish Cache log not working

varnishlog is returning:
_.vsm: No such file or directory
Has anyone else seen this before?
It looks like varnishlog is not pointing to the correct directory, or has not access to it.
Please check the command line options of varnishd. If the deamon run with -n <instancename> argument, you have to add it to varnishlog as well.
The second thing, is to see the permissions of varnish directory.
In order to see the current directory used, you must log into root and run the command below :
$ lsof -p <PID of varnishd> | grep vsm
Once revealed, you just had to be sure the full path has read permission for your user.
In Varnish 4.1 the root cause can be due to incorrect rights for reading _.vsm file. For example:
# service varnishncsa start
* Starting HTTP accelerator log deamon [fail]
Can't open log - retrying for 5 seconds
Can't open VSM file (Cannot open /var/lib/varnish/dev-me/_.vsm: Permission denied
Varnishncsa works from varnishlog user. But /var/lib/varnish/dev-me/_.vsm can be readable from varnish group or root user only:
# ls -l /var/lib/varnish/dev-me/_.vsm
-rw-r----- 1 root varnish 84934656 Apr 15 05:58 /var/lib/varnish/dev-me/_.vsm
So you can fix this problem in the following way:
# usermod -a -G varnish varnishlog
# id varnishlog
uid=110(varnishlog) gid=116(varnishlog) groups=116(varnishlog),115(varnish)
And now you can start varnishncsa.
In our case the hostname of the server was changed.
If you do not specify an instance name, varnish uses the hostname. It was looking for a directory holding the shared memory logging configuration with the new hostname, but the instance was still running from the directory with the old hostname.
Restarting varnish solved the problem.
I just had the same error message while trying to issue varnishadm commands. Turned out that I renamed my machine without stopping varnish. There was some directory in /var/varnish/ corresponding to the machine name that varnish needed access to. "sudo service varnish restart" fixed this for me.

apachectl start can't find httpd but it is there?

Complete newbie to the Unix and Apache world.
Just configured and installed Apache (successfully as far as I know) on a remote server, via X-Win32 SSH.
In the bin directory I see "httpd" listed.
To start the web server my provided instructions for the server state:
From your installation Apache directory type, './bin/apachectl start'.
However, I get the following error (11-14 just showing it is there):
server.edu(11): ls
bin cgi-bin conf htdocs icons include libexec logs man proxy
server.edu(12): cd bin
server.edu(13): ls
ab apxs dbmmanage htpasswd logresolve
apachectl checkgid htdigest httpd rotatelogs
server.edu(14): cd ..
server.edu(15): ./bin/apachectl start
./bin/apachectl: apache/bin/httpd: not found
./bin/apachectl start: httpd could not be started
Any help is greatly appreciated.
Thank You!
EDIT #h4b0
server.edu(98): pwd
/home/scf-25/gmcnulty/apache_1.3.42/apache
server.edu(99): ls -l bin/httpd
-rwxr-xr-x 1 gmcnulty 28880 May 24 22:12 bin/httpd
EDIT2 #h4b0
server.edu(102): ls
ab apxs dbmmanage htpasswd logresolve
apachectl checkgid htdigest httpd rotatelogs
server.edu(103): cd ../..
server.edu(104): ls
ABOUT_APACHE NOTICE README cgi-bin htdocs
INSTALL NWGNUenvironment.inc README-WIN.TXT conf icons
LICENSE NWGNUhead.inc README.configure config.layout logs
Makefile NWGNUmakefile WARNING-WIN.TXT config.status src
Makefile.tmpl NWGNUtail.inc apache configure
server.edu(105): ./apache/bin/apachectl start
fopen: No such file or directory
httpd: could not open error log file apache/apache/logs/error_log.
./apache/bin/apachectl start: httpd could not be started
Check permissions for httpd
Does apache/bin/httpd actually exist? Show pwd output from directory at line 11

Resources