Blog

Disposable and Secure phpinfo using a Pod Page

If you’re a dev and you find yourself uploading a file to run phpinfo(); why not try using a disposable Pod Page that’s access controlled by WordPress?

Create a new pod page and name it ‘phpinfo’, then place the following code in your ‘Precode’ area, then change the Page Template selected to ‘Page’ or ‘Page (WP Default)’ (depending on your theme).


<?php
$pods = 404;
if (is_user_logged_in() && (current_user_can('administrator') || (function_exists('is_super_admin') && is_super_admin()))) {
    phpinfo();
    die();
}

Now try going to yoursite.com/phpinfo/ and you’ll see the info for your PHP configuration but someone who’s not an admin for your site can’t 🙂

No extra files.. no access to anyone who might use this information against you.