Your're doing it the hard way.
Since you intend for the server to be on your local machine (or a different machine of yours locally). The text will exist in plaintext:
- in the keyboard you are typing it on
- within your browser's state and computer's memory
- perhaps on disk swap
If your local machine is compromised, the best encryption in the world doesn't protect you. Edit the file locally using your favorite editor and encrypt it locally with your encryption of choice. It beats having to re-invent two wheels.
If you are doing this as an academic exercise, have fun, but some random blogger's PHP implementation of AES is best not trusted unless you've reviewed the code for holes yourself and have tested its output against a reference AES for many inputs. I'm not assuming malice on the PHP author's side, just that the smallest defect in cryptographic software tends to make it useless.