(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
Redhat64位服务器重启后出现该问题,研究了一下午,发现解决办法:
问题说明80端口被占用,用netstat -nlp |grep :80命令看看有什么进程占用了80端口,发现是httpd进程。killall -9 httpd杀掉所有的httpd进程后,用service httpd start命令重启apache服务器,发现现在能够正常重启,不会出现上述问题
检查了一系列东西,最后发现是防火墙的问题,service iptables stop关闭防火墙后,远程测试能够正常访问服务器
PS:一天后发现并没有从根本上解决问题~APACHe还是会自动关掉,启动的时候还是上面的提示
网上找了一个解决办法
3. Third solution is to change binging address in your httpd.conf like this:
Listen 127.0.0.1:80 ( that means: instead of Listen 0.0.0.0:80)
然后我修改了/etc/httpd/conf/httpd.conf
把里面的Listen 80修改为
Listen 127.0.0.1:80
然后重启apache,看看明天还出不出这个问题~
PS:貌似还是不太对~网站直接无法访问了,然后我看看配置文件里的例子~貌似要写服务器IP的
于是我直接改成了VPS的IP(这个IP每个服务器都不一样,根据自己的服务器IP修改),类似
Listen 123.123.123.123:80
再测试看看~
PS:apache还是不停地自动关闭,实在没办法~去查了一下错误日志
在/var/log/httpd/里面error_log
看了一下,原来是DEDE程序用了老函数,php5.3以上已经不支持了
[Wed Apr 13 00:16:15 2016] [error] [client 66.249.77.20] PHP Deprecated: Function ereg() is deprecated in /var/www/html/xxx.com/include/arc.listview.class.php on line 681
一堆类似的错误,好吧修改吧
这是因为php5.3中不再支持eregi()函数,而使用preg_match()函数替代。
解决的方法是:将eregi()函数替换成preg_match() 函数。
if(eregi(‘^test’,$file))
可以替换为
if(preg_match(‘/^test/i’,$file))
————-
PHP 5.3.0 之後的 regex, 希望使用 PCRE 的規格, POSIX Regex 都不建議使用了(統一 Regex, 避免規格太多?).
所以下述是不建議使用的 Function (POSIX), 與建議替換成的 Function (PCRE) 列表, 詳可見: PHP:
Differences from POSIX regex
* POSIX → PCRE
* ereg_replace() → preg_replace()
* ereg() → preg_match()
* eregi_replace() → preg_replace()
* eregi() → preg_match()
* split() → preg_split()
* spliti() → preg_split()
* sql_regcase() → No equivalent
* 需要 regex 的 split, 可用 preg_split() 代替
* 不需要 regex, 只要要快速分割固定的字串, 可用 explode() 代替. (速度會比需要 regex 的快很多)