You should not use your own AJAX handler PHP file. Your problem is that your file calls add_action() function and that function is part of WordPress, your file is not loaded in the WordPress context, so that function is not loaded. You need to load WP in your file first.
But, that is not a good way to do this. WordPress already has a dedicated AJAX handler file and you should be using that, and not your own file that might be a security risk.
This is a good article on using AJAX in plugins and it is on official WordPress Codex: AJAX in Plugins.