20171114

Change $_SERVER['DOCUMENT_ROOT']

$_SERVER['DOCUMENT_ROOT'] is set in the httpd.conf file with the DocumentRoot directive

sometime for testing purposes you need to change it.

lets say you are testing a PHP app in /var/www/newapp and you want to set document root to that

1. create a file:

/var/www/newapp/set_document_root.php

in it place

<?php
$_SERVER['DOCUMENT_ROOT'] = '/var/www/newapp';
?>


2. edit php.ini

at the bottom of your php.ini file add

auto_prepend_file = "/var/www/newapp/set_document_root.php"

3. restart Apache

No hay comentarios:

Publicar un comentario