MAMP Apache will not start - Permission Denied: make_sock - mysql

MySQL and PHP was working fine with my MAMP for a very long time, so I really don't know what happened. Now every time when I try to log into my Apache from the terminal I get:
httpd: Could not reliably determine the server's fully qualified domain name, using MacBook.local for ServerName (13)Permission denied: make_sock: could not bind to address [::]:80 (13)Permission denied: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs
(I didn't include the actual name for the server)
I'm using a OS X system with Apache 2.2 and I don't think I properly configured my server. How do I fix this and get back on track? I did delete some of the member access and moved my htdoc files so that I could start over with my files. I believe that is where it turned against me.

It sounds like a permissions issue. Go to your terminal and have your MAMP status dialog open.
First issue:
sudo apachectl -k stop
then
sudo apachectl -k start
what you're doing is you're using sudo to get root permissions. See if that helps.

Rename the file envvars located in /Applications/MAMP/Library/bin into _envvars It worked for me. You may need to restart.

Related

Kill parent of mysqld process on MacOS

I have a Docker machine, and I want it to be able to use port 3306. But that port is already in use.
I don't remember installing MySQL on the host machine, but I've done a lot of dumb things over the years, so there's a good chance I did. I run brew services list to see if it's a brew service that is blocking the port. Nope. Nothing is listed.
So I run sudo lsof -i tcp:3306 and get the following:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 71046 _mysql 28u IPv6 0xbdab224a8a9b989f 0t0 TCP *:mysql (LISTEN)
OK. Simple to kill, right? I run sudo kill -QUIT 71046 and run sudo lsof -i tcp:3306 again. Now there's a different process listening on the same port:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 71207 _mysql 28u IPv6 0xbdab224a8a9ba41f 0t0 TCP *:mysql (LISTEN)
This process goes on as many times as I care to repeat it. Trying to run mysql or mysqld runs into a command not found error.
So my question: What command do I have to run to permanently stop mysqld from respawning ad infinitum?
(Bonus points if you can help me get rid of the setting that starts it automatically when my machine starts.)
I gave a comment above that led you to the answer, but here's a more full explanation for the benefit of future readers:
I infer you are on MacOS because you mention brew. MacOS is weird because there are multiple ways to run MySQL Server. Brew is one of them, but the official download from MySQL.com uses a native package installer, and creates a launch daemon and a System Preferences pane to manage the launch daemon.
https://dev.mysql.com/doc/refman/5.7/en/osx-installation-prefpane.html
You can use the preferences pane to start and stop the launch daemon, or enable/disable its automatic startup.

Zabbix server is not running: the information displayed may not be current

So all of a sudden, after a week of using it, I get an error message on my zabbix server gui (http://localhost/zabbix/.)
The error says: Zabbix server is not running: the information displayed may not be current.
Any idea why is this happening ll of a sudden and out of the blue? I restarted the machine - which should automatically restore the zabbix server upon startup - but it's still not running.
I also researched for a startup or restart command but true to form with zabbix helpful, clear documentation is non-existent.
EDIT:
Some more info:
MySQL is running normally. I'm able to select, insert into, whatever I want.
Doing /etc/init.d/zabbix-server status results in * zabbix_server is not running
The last entry in zabbix_server.log is Zabbix Server stopped. Zabbix 2.2.9 (revision 52686).
Doing sudo /etc/init.d/zabbix-server start results in * Starting Zabbix server zabbix_server but the status is still not running and the log file doesn't have any new entries.
just get into the zabbix.conf.php
>$sudo vim /etc/zabbix/web/zabbix.conf.php
>$ZBX_SERVER = '**your zabbix ip address or DNS name**';
>$ZBX_SERVER_PORT = '10051';
>$ZBX_SERVER_NAME = '**your zabbix hostname**';
just change the ip address you can resolve the error
Zabbix server is not running: the information displayed may not be current
After that restart the zabbix server
>$sudo service zabbix-server restart
To verify go to Dashboard Administration -> queue there you see data
i resolved my error like this works fine for me.
To solve the problem zabbix server is not running you have to :
First - Check that all of the database parameters in zabbix.conf.php ( /etc/zabbix/web/zabbix.conf.php) and zabbix_server.conf ( /etc/zabbix/zabbix_server.conf) to be the same. Including:
• DBHost
• DBName
• DBUser
• DBPassword
Second- Change SElinux parameters:
#setsebool -P httpd_can_network_connect on
#setsebool -P httpd_can_connect_zabbix 1
#setsebool -P zabbix_can_network 1
After all, restart all services:
#service zabbix-server restart
#service httpd restart
worth a try.
Edit this file: sudo nano /etc/default/zabbix-server
Adjust the START property to yes:
START=yes
Then try to run Zabbix again: sudo service zabbix-server start
This may happen because of the old and new IP address
I have faced same issue which was solve by below method:
vim /etc/zabbix/web/zabbix.conf.php
$ZBX_SERVER = new ip address
then restart zabbix server
I was using a special character in my DB password - wrapping the DBPassword option in /etc/zabbix/zabbix_server.conf and doing sudo service zabbix-server restart got me back up and running.
Not Working
DBPassword=MyString?
Working
DBPassword='MyString?'
Solution might be this simple:
sudo su
nano /etc/zabbix/zabbix-server.conf
Remove "#" in front of DBPassword=YourPassword (will change from blue to grey)
Ctrl x (Y to save and press enter to exit)
service zabbix-server restart
Now you can refresh your browser running ZABBIX. If not, you will have to do the same steps for CacheSize=32M
You do not have to change anything in /etc/zabbix/web/zabbix.conf.php (localhost is fine)
When editing anything, remember "#" in front of line means invisible to linux.
As Zabbix Senior Instructor and Consultant Hernandes Martins says in his "Zabbix server is not running what to do?" blog post:
This is the first step that should be checked regardless of the situation, always view the logs, from the moment the error message appeared in the zabbix web interface always view the log.
By following his advice I could be able to identify the cause of the issue with my Zabbix server, and then apply the solution related to the specific problem.
In my case, as I've commented in the page:
The problem in my server was of "4. Resource Allocation Issues". Just like you wrote above, Zabbix was showing out of memory errors on the log when trying to start the server.
After increasing the value of parameter CacheSize I tried to restart the service, but it didn't respond. So, I ended up restarting the whole machine. Fortunately, in the end it resolved the problem for good.
So, take a look at the log with command tail -f /var/log/zabbix/zabbix_server.log on the terminal/prompt, watch for any errors, and tackle the problem according to what it makes sense for your particular case.
Looks like the problem was that I created a Database monitoring Item programmatically and it triggered a bug that caused the server to shutdown.
Once I deleted the item the server came back up, and creating subsequent Items didn't kill it.
The deadly Item had a value_type of Numeric unsigned, -1 programmatically, while the newly created Items have a value_type of float, which is 0 programmatically.
The whole thing has a voodoo element to it but it did solve my problem.
Maybe is configuration issue
nano /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix_db
DBUser=zabbix_user
DBPassword=XXXXXXX
works for me on Zabbix 3.0 Centos 7
The zabbix-server daemon doesn't seem to like passwords with special characters in them. Unsure whether quotes would work in the configuration I just removed special characters from the database password, updated the configuration files and restarted the daemon.
Configuration parsing errors don't show up in logs for some reason.
Install nmap (( # yum/apt-get install nmap ))tool and check to find out which port the zabbix is listenning to?(( # nmap -sT -p1-65535 localhost )) 10050 or 10051?
The result should be somthing like this:
Starting Nmap 6.40 ( http://nmap.org ) at 2016-11-01 22:54 IRST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00032s latency).
Other addresses for localhost (not scanned): 127.0.0.1
Not shown: 65530 closed ports
PORT STATE SERVICE
22/tcp open ssh
25/tcp open smtp
80/tcp open http
3306/tcp open mysql
10050/tcp open unknown <--- In my case this is it
Then open /etc/zabbix/web/zabbix.conf.php and check the line starting with: $ZBX_SERVER_PORT , it's value should be the same number you saw in the nmap scan result. Change it and restart zabbix-server and httpd and you are good to go!
There maybe IP address conflict, try host 'Zabbix server'
On RHEL/CentOS/OEL 6
Check that the firewall is allowing connection to Zabbix Server port which is 10051, as a user with root priv:
vi /etc/sysconfig/iptables
and add the following lines
-A INPUT -m state --state NEW -m tcp -p tcp --dport 10051 -j ACCEPT
restart iptables
# service iptables restart
If you have disabled IPV6, you need to also edit the hosts file and remove IPV6 line for "localhost"
# vi /etc/hosts
remove or comment out "#" the ipv6 line for localhost
::1 localhost6.localdomain6 localhost6
restart the zabbix-server and check if the error message is gone.
I was in the same trouble.
For my case, that was a conflict between /etc/zabbix/zabbix_agentd.conf and zabbix_server.conf parameters.
I adjusted
"DBHost=localhost",
"DBName=zabbix",
"DBUser=zabbix",
"DBPassword=******",
"DebugLevel=3"
"ListenPort".
If you run the default installation, you should keep ListenPort=10051 for the server and 10050 for the agent.
Cheers!
In my case it happens when introducing host with templates, graphs,trigger etc, the server falls.
The problem was that by default the cache is at 128k and you have to change it.
sudo nano /etc/zabbix/zabbix-server.conf
Uncheck # Sizecache and add 32M for example.
Cachesize=32M
restart service and voila!! server working
service zabbix-server start
My problem was caused by having external ip in $ZBX_SERVER setting.
I changed it to localhost instead so that ip was resolved internally,
$sudo nano /etc/zabbix/web/zabbix.conf.php
Changed
$ZBX_SERVER = 'external ip was written here';
to
$ZBX_SERVER = 'localhost';
then
$sudo service zabbix-server restart
Zabbix 3.4 on Ubuntu 14.04.3 LTS
I had the same issue.
I forgotten selinux conf, not all is ok:
setsebool -P httpd_can_connect_zabbix on
In my case, this occurred because the password in the server config file was commented out.
Open the server config file: # sudo vim /etc/zabbix/zabbix-server.conf
Scroll down to db user and below there will be the password with a # commenting out. Remove the hash and insert your DB password.
In my case i had to disable Linux SE
[root#webserverlocaldomain /]# setenforce 0
Disable Firewall
[root#webserverlocaldomain /]# systemctl stop firewalld
Edit config file uncommenting#
[root#webserverlocaldomain /]# vi /etc/zabbix/zabbix_server.conf
ListenPort=10051
DBHost=localhost
DBPassword=password
Then restart the services
[root#webserverlocaldomain /]# systemctl restart zabbix-server zabbix-agent httpd
#getsebool -a
//httpd_can_network_connect off
#setsebool httpd_can_network_connect on
#getsebool httpd_can_network_connect
#service zabbix-server restart
in my case after installing zabbix from sources (removed zabbix 4.0 because upgrading to 4.2 wasn't possible via apt on a Raspbian GNU/Linux 9.4 stretch) it loaded the config from /usr/local/etc/zabbix_server.conf instead from /etc/zabbix/zabbix_server.conf
After deleting /usr/local/etc/zabbix_server.conf and creating a symlink pointing to the correct config file in /etc/zabbix/zabbix_server.conf it started to work
I solved this problem on Ubuntu 18.04 by uninstalling Zabbix and reinstalling it again from scratch.
The initial installation didn't work because I had followed old posts/guides/tutorials, even from Zabbix documentation itself, so these might probably be outdated. So, the trick was to find and follow the most updated guide to Zabbix installation from its docs.
Here are the two links I followed for uninstalling and reinstalling Zabbix:
How to uninstall Zabbix: https://www.quora.com/How-do-I-uninstall-Zabbix-server-agent-in-Ubuntu
How to (properly) install Zabbix: https://www.zabbix.com/download?zabbix=4.0&os_distribution=ubuntu&os_version=18.04_bionic&db=postgresql
When installing Zabbix from the link above, your choosen Zabbix Version, OS Distribution, OS Version or Database may be different from the ones I've selected, but following the instructions on this page will probably be also the right way for you to install your chosen Zabbix configuration without getting errors post installation.
Never had the problem until it suddenly appeared once, for me, the solution was to add (uncomment) the following line in /etc/zabbix/zabbix_server.conf
ListenIP=0.0.0.0
i had similar problem and my gui reported problem with cache, i change it zabbix-server.conf to 32M and now is ok, zabbix is an intelligent tool, please if it possible check problems in gui first. I had to much hosts ... for default cache.

Errno 13 Permission denied using Gunicorn

I'm running django on Digital Ocean with gunicorn and nginx. Gunicorn for serving the django and nginx for static files.
Upon uploading a file via website, I cant save to a folder in /home directory. I get [Errno 13] Permission denied.
Please, how do I make the web server to be able have read write access to any arbitrary folder anywhere under /home?
This all depends on the user that your application is running as.
If you check ps aux | grep gunicorn which user the Gunicorn server is running your app as then you can change the chmod or chown permissions accordingly.
ls -lash will show you which user current only owns the folder and what permissions are on the folder you are trying to write to:
4.0K drwxrwx--- 4 username username 4.0K Dec 9 14:11 uploads
You can then use this to check for any issues.
Some docs on changing ownership and permissions
http://linux.die.net/man/1/chmod
http://linux.die.net/man/1/chown
I would advise being very careful to what locations on your disk you give access for the web server to read/write from. This can have massive security implications.
Well, I worked on this issue for more than a week and finally was able to FIGURE IT OUT.
Please follow links from digital ocean , but they did not pinpoint important issues one which includes
no live upstreams while connecting to upstream
*4 connect() to unix:/myproject.sock failed (13: Permission denied) while connecting to upstream
gunicorn OSError: [Errno 1] Operation not permitted
*1 connect() to unix:/tmp/myproject.sock failed (2: No such file or directory)
etc.
These issues are basically permission issue for connection between Nginx and Gunicorn.
To make things simple, I recommend to give same nginx permission to every file/project/python program you create.
To solve all the issue follow this approach:
First thing is :
Log in to the system as a root user
Create /home/nginx directory.
After doing this, follow as per the website until Create an Upstart Script.
Run chown -R nginx:nginx /home/nginx
For upstart script, do the following change in the last line :
exec gunicorn --workers 3 --bind unix:myproject.sock -u nginx -g nginx wsgi
DONT ADD -m permission as it messes up the socket. From the documentation of Gunicorn, when -m is default, python will figure out the best permission
Start the upstart script
Now just go to /etc/nginx/nginx.conf file.
Go to the server module and append:
location / {
include proxy_params;
proxy_pass http<>:<>//unix:/home/nginx/myproject.sock;
}
REMOVE <>
Do not follow the digitalocean aricle from here on
Now restart nginx server and you are good to go.
Change the owner of /home
See actual owner $ ls -l /
f1 f2 f3 f4 f5 f6 f6 f8 f9 f10
- rwx r-x r-x 1 root root 209 Mar 30 17:41 /home
https://www.garron.me/en/go2linux/ls-file-permissions.html
f2 Owner permissions over the file or directory
f3 Group permissions over the file or directory
f4 Everybody else permissions over the file or directory
f6 The user that owns the file or directory
Change folder owner recursively sudo chown -R ubuntu /home/ substitute ubuntu with a non-root user.
Good practices
Use a subdirectory home/ubuntu as server directory, ubuntu folder have ubuntu user as owner.
Set user-owner permissions to all. Your group and other users to read-only sudo chmod -R 744 /home/ubuntu/
I changed the ownership of the file which is containing my images
chown -R www-data: /myproject/media/mainsite/images
Change the path accordingly and also restart server. In my case its apache2 so
sudo service apache2 restart
In my case it was something very simple that was generating a similar error, I just had to check the user who controlled Gunicorn and the user who controlled NGINX, they had different permissions.

Apache and MYSQL not starting in XAMP

I have a problem here that I had my XAMP up and running, I installed ZEND Framework, ZEND Server and ZEND Studio into my system. Now the problem is that localhost is not working. I researched to find out that both can be on a pc and run but I will have to choose between the apache for the two. I stopped the services of Apache Zend but my localhost did not start.
I also checked the error log of apache the last entry is of Today i.e. Tue 10:28am. and XAMP control panel just displays cannot start apache service.
I have changed the apache config file by changing the localhost server port to 8080 instead of 80. But no success yet. MYSQL is also shutting down unexpectedly.
Any help is appreciated.
I have a same problem when I installed Skype. Skype by default use 80 port number. So you can change it from Skype`s options. For more info see this link..
http://www.youtube.com/watch?v=n7wj1aaNwbU
Try to run this below command in cmd prompt
netstat -ano|find "port no"
Eg:
netstat -ano|find "3306"
TCP 0.0.0.0:3306 0.0.0.0:0 LISTENING 5164
TCP [::]:3306 [::]:0 LISTENING 5164
You could even use the pid number and check in windows task manager who is utilizing these pid so that you would come to know the exact process name
Please provide error log file if possible.

Missing /var/lib/mysql/mysql.sock file

I'm trying to access mysql and when I run the mysql command, I get the following.
[root#ip-10-229-65-166
tpdatabase-1.8.0.28356]# mysql
ERROR 2002 (HY000): Can't connect to
local MySQL server through socket
'/var/lib/mysql/mysql.sock' (2)
Doing this returns nothing
[root#ip-10-229-65-166 mysqld]# find
-name mysql*
[root#ip-10-229-65-166 mysqld]#
/etc/init.d/mysql stop
-bash: /etc/init.d/mysql: No such file or directory
[root#ip-10-229-65-173
tpdatabase-1.8.0.28356]# mysql_config
|grep -- --socket
--socket [/var/lib/mysql/mysql.sock]
Maybe a permissions problem?
I do have mysql installed using yum install mysql
I'm running CentOS 5.4 on a Amazon EC2 Cloud Instance
You need to install the server package:
sudo yum install mysql-server
After installation, you have to start the service:
sudo service mysqld start
rm -rvf /var/lib/mysql/ib_logfile*
touch /var/lib/mysql/mysql.sock
touch /var/lib/mysql/mysql.pid
chown -R mysql:mysql /var/lib/mysql
systemctl restart mysql
try this and check the permission of both /var/lib/mysql/mysql.sock and /tmp
We faced a similar problem in my office setup with the same OS. The actual thing that was happening was low space on the server. It is quite strange, but i believe if the server gets full the files cannot be loaded or of some other resort. Please check to be sure the space on the server is enough else you have to try removing the installed mysql and reinstall. Best of luck.
just search for mysqld, this is the server daemon:
find / | grep mysqld
If you found it, the server package may be correctly installed but without initd scripts. For testing, you may start the mysql server by hand executing the above file.
mysql might have been packaged separately as client and server. Check your package repositories to make sure that the server has been installed. The mysql package might only be the client. Check if there's a package called mysql-server or something similar. Check the list of files installed by the mysql package to see if it actually installs the server.
If the files are not even there, it's not a permissions problem. Also, you're running as root.
I recently encountered this problem after an upgrade on Ubuntu 18.04. The solution here solved it https://serverfault.com/a/957723/439448.
Make sure you have privileges to access the /var/lib/mysql/mysql.sock file. And if you still get the error, create a default my.cnf file with
[client]
socket = /path/to/mysql/data/mysql.sock
[mysqld]
server-id = 2
socket = /path/to/mysql/data/mysql.sock
port = 4000 #any port you wish
basedir = /path/to/mysql
datadir = /path/to/mysql/data
and initialize the database again. Make sure you give --defaults-file=/path/to/mysql/my.cnf when you initialize. If you get error saying files exist in /path/to/mysql/data, remove them and try again. Once done, when you run mysql also, give --defaults-file=/path/to/mysql/my.cnf.
Should work.
Before hitting mysql on command prompt make sure your correct my.cnf configuration file is in placed and set the permission of etc folder as
chmod -R 777
etc folder as below list to avoid
error MySQL - ERROR 2002 (HY000):
e.g /etc/my.cnf, /etc/mysql/my.cnf, $MYSQL_HOME/my.cnf [datadir]/my.cnf ~/.my.cnf