INSERT in a remote server is far too slow, how to speed it up?
Since  most mysql versions turn on autocommit, use a transaction to have the server sync data to disk only once and not on every row.

Add at the top of your .sql:

BEGIN TRANSACTION;


and append at the end:

COMMIT;


This will have the added advantage that either all will be inserted or none at all. Same for your php script. Or you may add begin/commit every say 50000 rows to commit in batches.