[eluser]@li[/eluser]
You're getting the 500 internal server error by apache when this script runs. Which means there is a problem with your apache settings. Do you keep an error_log file on your apache system? If so, please post the contents of the last few error messages here.
You may also want to contact your web host's technical support and ask about this.
Let us know!