XAMPP 5.6.3-0
Mac Yosemite 10.10.5
I ran sudo lsof -nP -iTCP:81 and found that Dropbox was blocking it first, so I unlinked that (never use it). Now, when I run that command, it is empty.
If I run sudo lsof -nP -iTCP:80 I get:
httpd 75 root 4u IPv6 0xaac1841fb411203d 0t0 TCP *:80 (LISTEN)
httpd 532 _www 4u IPv6 0xaac1841fb411203d 0t0 TCP *:80 (LISTEN)
Which I think is okay, since it's on a different port, right?
If I look inside the /Applications/XAMPP/logs for the error_log, ssl_request_log, and access_log there isn't anything logged since two months ago.
If I look inside the php_error_log I see this:
[08-Jan-2016 16:13:43 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20131226/php_pdo_mysql.dll' - dlopen(/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20131226/php_pdo_mysql.dll, 9): image not found in Unknown on line 0
I found a similar problem in this question. I ran the command in the top answer (but obviously changed the dir path to mine), and it didn't work. I read the forum with the link he attached and someone said that on Mac is is DYLD_LIBRARY_PATH not LD_LIBRARY_PATH, so i tried that as well, and it still doesn't work. I've tried restarting my computer and the osx-manager multiple times.
If I look inside the /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20131226/ directory, it doesn't have php_pdo_mysql.dll in there. Is it supposed to be in there already, or is it trying to load the library in there, and it's not working?
I get the dynamic library error every time I try to start it, so I'm guessing that is the issue, but I'm not sure how to fix it.
For clarity, I have these lines in my httpd.conf file:
Listen 81
ServerName localhost:81
And in my php.ini file I have the extension=php_pdo_mysql.dll line uncommented, and it's the only extension uncommented. Does it depend on another extension? I'm so lost.
Update
$ . /Applications/XAMPP/xamppfiles/xampp stopapache
$ XAMPP: Stopping Apache...not running
$ . /Applications/XAMPP/xamppfiles/xampp startapache
$ XAMPP: Starting Apache...fail.
$ XAMPP: Another web server is already running.
But running lsof -nP -i :81 still gives me no results! =(
Well, I had to shut down the Apache server running on port 80 for this to work. I thought I wouldn't have to, since I had it configured to run on port 81. My only guess to why this happened is that I had it configured on port 80, started it, and then changed the configuration to 81 before shutting it down. I also had to comment out the php_pdo_mysql extension. I couldn't figure out that issue.
I have a VPS with CentOS and DirectAdmin installed.
This VPS only have one site with WordPress CMS but Apache have very usage of 1 GB Ram.
for this i buy license and install Danginx plugin.after installing dangnix, my site and IP only show "Welcome to Nginx" text and every other files show 404 error page.
after many Google searchs, everyone says install new ioncube loader but i installed this before Dangnix installation and more than 2 time reinstall.
php -v command also show ioncube loader has installed but my site still show Welcome text.
when i restart apache with service httpd restart command show this error :
NameVirtualHost 79.127.127.143:8888 has no VirtualHosts
(98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
after many edits now this command show only "NameVirtualHost 79.127.127.143:8888 has no VirtualHosts" error.
Sorry for my bad english.
Thanks.
I think your problem is that it is port 8888. If you go to your website, default port is 80. Nginx only shows the message "Welcome to Nginx" if the port is not getting anywhere, so this is a configuration problem in Nginx.
First thing, I could see out there has already solved questions around the problem.
PHP web socket unable to bind socket
Issue in setting the socket server
socket_bind(): unable to bind address [99] (Ubuntu on Amazon EC2)
and many other resources, all of them said that problem is in-used port or external IP,
etc.
But I could not get over it.
My server is running on CentOS 6.3 and using CPanel (it is the HP server https://www.hpcloud.com/).
The web socket demo source code what I get is on https://code.google.com/p/phpwebsocket/
My setting is
$master = WebSocket("127.0.0.1",4444); // even I tried with localhost, they worked same
Here is the step what I tried and the corresponding errors:
1/. I tried following commands to ensure a port which I was using is available to use
$ lsof|grep 4444
$ netstat -a -p -n
But I always got the error although this port 4444 is free
Warning: socket_bind(): unable to bind
address [98]: Address already in use in
/home/myapp/public_html/websocket/server.php on line 60
2/. The strange thing is when I checked the port 835 which was using by
crond 1621 root DEL REG 252,1 39835 /lib64/libpam.so.0.82.2.#prelink#.B1eyGx
atd 1633 root DEL REG 252,1 39835 /lib64/libpam.so.0.82.2.#prelink#.B1eyGx
The funny thing happened:
Then I ran the server.php on my terminal command shell
php /home/myapp/public_html/websocket/server.php
the error has gone, instead of it is
Server Started : 2013-08-16 03:19:54
Master socket : Resource id #4
Listening on : 127.0.0.1 port 835
I thought that it started working, but actually it did not, because when I open server.php by the browser with URL
http://mysite/server.php
The error is "permission denined"
Warning: socket_bind() [function.socket-bind]: unable to bind address
[13]: Permission denied in
/home/myapp/public_html/websocket/server.php on line 60
socket_bind() failed
Edited: About permission, I could open the client.html in same level directory with server.php without problem.
The folder code permission is 755 and user is not root.
All of my commands was implemented under root privilege
Any help is greatly appreciated :(
I would assume that the problem is that you are attempting to load the Websocket server in your webbrowser. Most likely, there are security settings for the apache user that does not allow your server to listen on uncommon ports.
CentOS usually ships with SELinux enabled by default. Part of CentOS Linux's security policies for Apache are that by default, Apache will only allow services access to recognized ports associated with HTTP (ie, port 80, 8080 etc).
With SELinux enabled, you could allow Apache to listen on tcp port 4444 by adding a rule to allow that inside SELinux using the 'semanage' command:
~$ semanage port -a -t http_port_t -p tcp 4444
Alright, when I go to install Apache 24 by command prompt with this code going into it's bin.
httpd.exe -k install
then I run httpd.exe
I get this error.
AH00558: httpd.exe: Could not reliably determine the server's fully qualified do
main name, using fe80::d939:4e4:4915:276. Set the 'ServerName' directive globall
y to suppress this message
(OS 10013)An attempt was made to access a socket in a way forbidden by its acces
s permissions. : AH00072: make_sock: could not bind to address [::]:80
(OS 10013)An attempt was made to access a socket in a way forbidden by its acces
s permissions. : AH00072: make_sock: could not bind to address 0.0.0.0:80
AH00451: no listening sockets available, shutting down
AH00015: Unable to open logs
and then I pinged my port that is using 80. I get the PID of 4 which is my system with a description of NT Kernel & System.
Anyway I can fix this?
you could try to run command prompt as administrator
The port 80 is already used and when you try to modify it in the file conf/httpd.conf nothing changes. My mistake was that I assumed that the install folder is the one I have chosen to use via installation. If you go to services and find the Apache service and check the path to executable, you will see that it is not pointing to the folder that you thought you have installed it on. However, if you change the line "Listen 80" to "Listen 8080' in the httpd.conf file from the folder taken from the service path, it will most likely allow you to start the service.
I get a 502 Bad Gateway with nginx when using spawn fcgi to spawn php5-cgi.
I use this to span an instance on server start using the following line in rc.local
/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www-data -g www-data -f /usr/bin/php5-cgi -P /var/run/fastcgi-php.pid
presumably I'm getting the error because the spawn-fcgi / php5-cgi dies and there is nothing listening there anymore to parse php.
I get nothing in the logs that I can see anywhere, I'm out of ideas (and new to this setup with nginx)
I executed my localhost and the page displayed the 502 bad gateway message. This helped me:
Edit /etc/php5/fpm/pool.d/www.conf
Change listen = /var/run/php5-fpm.sock to listen = 127.0.0.1:9000
Ensure the location is set properly in nginx.conf.
Run sudo service php5-fpm restart
Maybe it will help you.
Source from: http://wildlyinaccurate.com/solving-502-bad-gateway-with-nginx-php-fpm
The 502 error appears because nginx cannot hand off to php5-cgi. You can try reconfiguring php5-cgi to use unix sockets as opposed to tcp .. then adjust the server config to point to the socket instead of the tcp ...
ps auxww | grep php5-cgi #-- is the process running?
netstat -an | grep 9000 # is the port open?
Go to /etc/php5/fpm/pool.d/www.conf and if you are using sockets or this line is uncommented
listen = /var/run/php5-fpm.sock
Set couple of other values too:-
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
Don't forget to restart php-fpm and nginx. Make sure you are using the same nginx owner and group name.
You have to match the settings for PHP-FPM and Nginx to communicate over sockets or TCP.
So go to /etc/php5/fpm/pool.d/www.conf and look for this line:
listen = /var/run/php5-fpm.sock
Then go to /etc/nginx/nginx.conf
Look for this:
upstream php {
server unix:/var/run/php5-fpm.socket;
}
Match those values and you should be all set.
If running a linux server, make sure that your IPTABLES configuration is correct.
Execute sudo iptables -L -n , you will recieve a listing of your open ports. If there is not an Iptables Rule to open the port serving the fcgi script you will receive a 502 error. The Iptables Rule which opens the correct port must be listed before any rule which categorically rejects all packets (i.e. a rule of the form "REJECT ALL -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-port-unreachable or similar)
On my configuration, to properly open the port, I had to execute this command (assume my fcgi server is running at port 4567):
sudo iptables -I INPUT 1 -p tcp --dport 4567 -j ACCEPT
WARNING: This will open port 4567 to the whole world.
So it might be better to do something like this:
sudo iptables-save >> backup.iptables
sudo iptables -D INPUT 1 #Delete the previously entered rule
sudo iptables -I INPUT 1 -p tcp --dport 8080 -s localhost -j ACCEPT # Add new rule
Doing this removed the 502 error for me.
change
fastcgi_pass unix:/var/run/php-fpm.sock;
to
fastcgi_pass unix:/var/run/php5-fpm.sock;
When I did sudo /etc/init.d/php-fpm start I got the following error:
Starting php-fpm: [28-Mar-2013 16:18:16] ERROR: [pool www] cannot get uid for user 'apache'
I guess /etc/php-fpm.d/www.conf needs to know the user that the webserver is running as and assumes it's apache when, for nginx, it's actually nginx, and needs to be changed.
You can make nginx ignore client aborts using:
location / {
proxy_ignore_client_abort on;
}
I had the same problem while setting up an Ubuntu server. Turns out I was having the problem due to incorrect permissions on socket file.
If you are having the problem due to a permission problem, you can uncomment the following lines from: /etc/php5/fpm/pool.d/www.conf
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
Alternatively, although I wouldn't recommend, you can give read and write permissions to all groups by using the following command.
sudo chmod go+rw /var/run/php5-fpm.sock
Try disabling the xcache or apc modules. Seems to cause a problem with some versions are saving objects to a session variable.
Hope this tip will save someone else's life. In my case the problem was that I ran out of memory, but only slightly, was hard to think about it. Wasted 3hrs on that. I recommend running:
sudo htop
or
sudo free -m
...along with running problematic requests on the server to see if your memory doesn't run out. And if it does like in my case, you need to create a swap file (unless you already have one).
I have followed this tutorial to create swap file on Ubuntu Server 14.04 and it worked just fine:
http://www.cyberciti.biz/faq/ubuntu-linux-create-add-swap-file/
If you're on Ubuntu, and all of the above has failed you, AppArmor is most likely to blame.
Here is a good guide how to fix it: https://www.digitalocean.com/community/tutorials/how-to-create-an-apparmor-profile-for-nginx-on-ubuntu-14-04
Long story short:
vi /etc/apparmor.d/nginx
Or
sudo aa-complain nginx
sudo service nginx restart
See everything working nicely... then
sudo aa-logprof
I still had problems with Nginx not being able to read error.log, even though it had all the permissions possible, including in Apparomor. I'm guessing it's got something to do with the order of the entries, or some interaction with Passenger or PHP-Fpm... I've run out of time to troubleshoot this and have gone back to Apache for now. (Apache performs much better too FYI.)
AppArmor just lets Nginx do whatever it wants if you just remove the profile:
rm /etc/apparmor.d/nginx
service apparmor reload
Shockingly, but hardly surprising, a lot of posts on fixing Nginx errors resorts to completely disabling SELinux or removing AppArmor. That's a bad idea because you lose protection from a whole lot of software. Just removing the Nginx profile is a better way to troubleshoot your config files. Once you know that the problem isn't in your Nginx config files, you can take the time to create a proper AppArmor profile.
Without an AppArmor profile, especially if you run something like Passenger too, I give your server about a month to get backdoored.
For me the error was in default file of Nginx
located at /etc/nginx/sites-available/default
I noticed the version of php-fpm used was 7.0 and the php version i downloaded was 7.2
I simply changed the version to 7.2 and it worked.
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
Similar setup here and looks like it was just a bug in my code. At the start of my app I looked for the offending URL and this worked: echo '<html>test</html>'; exit();
In my case, turns out the problem was an uninitialized variable that only failed under peculiar circumstances.