仅在创建/删除file / dir时运行脚本

How to run php script(s) !only! when file or directory is
created/deleted through ftp or via etc cms?

parallel to js, where you can create real time event listeners

for information I only have webserver w apache+php
I don't have permissions to install aditional packages

I already know about cron, but it runs on interval :S

I would look into inotify as it has the ability to recieve events when files or folders are created/modified/deleted.

Example:

$fd = inotify_init();
stream_set_blocking($fd, 0);
inotify_add_watch($fd,'./test/',IN_ALL_EVENTS);

while(true){
        $events = inotify_read($fd);
        if($events){
                print_r($events);
        }
        sleep(1);
}