AJAX: Internal Server Error 500

First lesson learned today: Always check the error logs whenever you get a weird server error with obscure message describing what actually transpired...

While attempting to use AJAX & PHP, I kept running into a weird Internal Server Error. After spending lots of time on google, it turns out that the problem was the PERMISSION (chmod) given to the PHP file being requested.

I had the php file set at PERM 0777, which apparently causes the server to freak out, because PHP files being writable can be a very, very dangerous thing.

Lesson #2: Set the permission for PHP on server to 0644.

MySQL on OS X

Seems like everytime I revisit mysql I'm confused about login & user creation, so here it is again:

log in using:

mysql -u USERNAME

create user using:

use mysql;
insert into user(host,user,password,select_priv) values
('localhost','USERNAME',password('PASSWORD'),'Y');

grant privileges to user:

grant all privileges on *.* to 'USERNAME'@'localhost' with grant option;

make sure to flush privileges to enable new accounts:

flush privileges;

to log in:

mysql --user=USERNAME --password=PASSWORD (optional: db name)