An error 500 is a generic PHP error. If you get if running that simple script, it must be related to a problem loading the classes or missing read or write access when generating the DOCX.
We recommend you to check your server logs to find the source of the problem and try running the same sample using the PHP CLI mode. An error 500 is always added to the logs with the reason of the error. If the license is not correct, phpdocx throws an Exception.