Community

How can I edit a PHP file from within MODX?

I would like to edit a standard .php file from within MODX. How can I do this?

On the Files tab in the manager, right-click on the file and select “Edit File.” If you have the Ace code editor extra installed, you’ll also get some minimal error checking and auto-completion.

1 Like

If you’re not allowed to save the PHP files, you’ll need to allow the php extension. Go to System > System Settings and search for the upload_files setting. Edit it, and add php into that comma-separated list. After that, saving PHP files will work.

Do note that allow users to edit PHP files from the manager can lead to either wrecking the site (e.g. editing the root index.php or configuration file) or them gaining additional permissions. If you have other users you don’t 100% trust with manager access, it’s best to disable php editing again after you’re done.

1 Like