How to render an entire page from external php page? I'm creating a custom .php page that is outside my drupal installation and it should render a custom page of the installation. The "entire" page, also with theme and everything else.

I'm using this code, works but is not loading the theme:

    &lt;?php

    /**
     * Root directory of Drupal installation.
     */
    define('DRUPAL_ROOT', '/home/quickstart/websites/custom.dev');

    include_once DRUPAL_ROOT . '/includes/bootstrap.inc';
    drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);


    drupal_deliver_html_page('user');
    ?&gt;


Where am I wrong?
drupal_deliver_html_page() is never called directly; you should eventually call drupal_deliver_page(). It also seem you are calling the function with the wrong argument, since drupal_deliver_html_page() doesn't get a path as argument, but the result obtained by a page callback.

The correct code would be the following one.

define('DRUPAL_ROOT', '/home/quickstart/websites/custom.dev');

require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
menu_execute_active_handler('user');


Since that is just the index.php code just slightly modified, I don't see any reason not to use http://example.com/user directly. A custom PHP file like that should be used to perform specific tasks, like in the case of cron.php. 

define('DRUPAL_ROOT', getcwd());

include_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

if (!isset($_GET['cron_key']) || variable_get('cron_key', 'drupal') != $_GET['cron_key']) {
  watchdog('cron', 'Cron could not run because an invalid key was used.', array(), WATCHDOG_NOTICE);
  drupal_access_denied();
}
elseif (variable_get('maintenance_mode', 0)) {
  watchdog('cron', 'Cron could not run because the site is in maintenance mode.', array(), WATCHDOG_NOTICE);
  drupal_access_denied();
}
else {
  drupal_cron_run();
}


Normally, you don't need to use a similar file, and you should handle it through a normal menu callback; this even more true when you need to just shown a specific page as you are doing.

Keep in mind that Drupal 8 doesn't use anymore the cron.php file; cron tasks are handled through a menu callback too.