2

Host: Amazon Web Services

Domain: Godaddy

SSL: Godaddy

Framework: Laravel 4.2

PHP: PHP5.6

Apache: Apache 2.4.16

File located: /var/www/html/test

My code:

$api_request = 'https://'.apache_getenv("HTTP_HOST") . apache_getenv("REQUEST_URI");

Error: PHP Fatal error: Call to undefined function apache_getenv()

It looks like it doesn't exist.

Laravel App Located at: html. Then another two folders with laravel: test and live.

  • html/ (Laravel app landing page)
    • app/
    • bootstrap/
    • packages/
    • public/
    • vendor/
    • test/ (Laravel app)
    • live/ (Laravel app)
    • index.php

It works properly at html app. but in test app the function doesn't exist anymore.

Marlon Buendia
  • 342
  • 1
  • 6
  • 19

2 Answers2

2

Can you please try

$_SERVER['HTTP_HOST'] and  $_SERVER['REQUEST_URI']

In place of apache_getenv some times apache does not allow you to access the functions without the module activation.

Hope this will help you.

Tristup
  • 3,603
  • 1
  • 14
  • 26
1

Looks like apache_getenv is disabled in your php.ini

Enable it by

Edit php.ini (By default /etc/php.ini)

Remove apache_getenv from disable_functions section

save and exit.

restart apache/php handler.

Harikrishnan
  • 9,688
  • 11
  • 84
  • 127