What are the advantages and disadvantages of using absolute paths versus relative paths in PHP scripts, especially in the context of web development?

When working with file paths in PHP scripts, using absolute paths can provide a fixed reference to a specific file or directory on the server, ensuring that the script will always locate the correct resource. However, absolute paths can be less portable and may cause issues when moving the script to a different server or directory. On the other hand, relative paths are more flexible and easier to manage, as they are based on the current working directory of the script. However, relative paths may lead to confusion or errors if the script is moved or included in different files.

// Using absolute path
include('/var/www/html/includes/config.php');

// Using relative path
include('includes/config.php');