Phalacrocorax
2/17/2017 - 2:54 AM

SERVER_OM

SERVER_OM

public function csvToArray($filename = '', $delimiter = ',') {
		if (!file_exists($filename) || !is_readable($filename))
			return FALSE;

		$header = NULL;
		$data = array();
		if (($handle = fopen($filename, 'r')) !== FALSE) {
			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) {
				if (!$header)
					$header = $row;
				else
					$data[] = array_combine($header, $row);
			}
			fclose($handle);
		}
		return $data;
	}

CLI COMMAND

lsof -i:8080 //lookup port

AWS HTTP ERROR 500

在做AWS的时候遇到过很多问题,经常是代码pull,访问500错误。数据库遇到的最多,因为password和本地不一样,没有用config区分开的话就很容易出错。 还有一些重要的vendor没有提交到master也会有这样的错误

解决办法

情况1 数据库 库名or密码错误

情况2 文件 core file缺失or没有读写权限

总的权限需要sudo chown -R root:www /var/www。

cache类似直接sudo chmod 777 var -R。 团队开发注意先设置git config core.filemode false

另外注意查看服务器日志👌

sudo tail -10 /var/log/httpd/error_log

ERR_CONNECTION_REFUSED

This site can’t be reached whatcode.cc refused to connect. 这是 sudo service httpd stop 的结果,应该就是服务器启动失败了,最近每次想要restart httpd必然出现的结果= =。 先查看配置文件

/usr/sbin/httpd -S

如果配置文件中有语法错误也会显示出来,然后可以看的DocumentRoot 以及ErrorLog地址。 seg fault or similar nasty error detected in the parent process sudo apachectl stop / sudo apachectl start / sudo apachectl graceful

ERR_EMPTY_RESPONSE

用gulp开发着,突然一刷新就出现这个错误,有点懵逼。难道是刚下的vueDraggable的错, 于是马上 npm unintsall然后git reset --hard

...没用, 访问localhost都不行,

sudo apachectl restart
Address already in use: make_sock: could not bind to address //= = 端口占用?
lsof -i | grep :80 //查一查
Shadowsoc TCP *:8090 (LISTEN) 

没想到是shadowsocks,为了看Nokisaka Official@youtube的视频, 把VPN调到日本然后开了Global Mode... 居然是这个锅。

#1045 无法登录 MySQL 服务器

在AWS EC2上的blog,试着用phpmyadmin