Menu

#1467 Define an absolute path to use for require statements

Needs_decision
open
nobody
None
Normal
2015-02-15
2013-10-28
No

I'm bootstrapping user authentication for phpMyAdmin with WordPress, and probably going to end up hacking the core of phpMyAdmin a bit to get it working properly.

The issue I'm having is that within phpMyAdmin, a few require and require_once expressions use a './path/to/file.php' structure, so the file that I bootstrap phpMyAdmin must be located in the same folder as phpMyAdmin's root.

May I suggest conditionally defining a constant and using it for require expressions?

<?php
if ( ! defined( 'PHPMYADMIN_ROOT' ) )
    define( 'PHPMYADMIN_ROOT', dirname( __FILE__ ) . '/' );

require( PHPMYADMIN_ROOT . 'path/to/file.php' );
?>

Discussion