I managed to solve the connectivity problem (restarted everything manually and it started working).
I made sure:
-> API is installed on php's include_path;
-> php is running on FMS 13 built in apache2handler (I tried a few examples);
-> php version meets requirements (5.4.24) and curl is enabled;
-> WPE is running (on localhost IP).
However, I still can't get php to connect to FMS databases (even to questionnaire tutorial db). I suspect the problem may be caused by Web Server utility, where it is specified "PHP is disabled", even though "Enable PHP publishing" is ticked in detailed settings.
Is there anything else I should do to enable PHP on Web Server? Can I switch this setting manually (in some conf file, or alike)?
I managed to solve this problem myself, after uninstalling FMS and then cleanly installing it. PHP Web publishing now works, even though Web Server keeps informing me "PHP is disabled", strangely enough there is a message "XML is enabled" even though I never enabled it.
I am listing the differences between my previous and current install that might have led to broken WPE:
-> existing installation of MAMP;
-> php.ini not including web server's root under include_path
-> telling FMS to install its own PHP