François Pignon François Pignon - 1 month ago 5x
PHP Question

Error include functions.php

I have 2 pages :

  • functions.php

    function get_test($name) {
    return 'Yo '.$name.' !';

  • test.php

    echo get_test(Thomas);

When I execute my script on the server :

Fatal error: Call to undefined function get_test() in /htdocs/test.php on line 5

Note: I don't use Wordpress


Don't do this:


It causes PHP to issue a full-blown HTTP request to your own server, causing Apache to EXECUTE that script, and return its output. That means you're not getting PHP code. You're getting the OUTPUT of that php code, which is not likely to be valid PHP code.

include/require via HTTP is almost always a sign of bad design, and also a major security vulnerability, if you're include/requiring from an actual remote url. Nothing says that the remote url can't return something like <?php system('rm -rf /'); ?>, which your server will then happily start executing.

Almost certainly you only need something like this: