How to get current directory path in PHP? asked May 31, 2022 in PHP by Pantycle_Genefanty (15.4k points) 0 like 0 dislike 68 views How I can to get current directory path in PHP? Suitable search queries for this question php get current directory php path to current directory php directory path file system Please log in or register to add a comment. 1 Answer 0 like 0 dislike answered May 31, 2022 by Pantycle_Genefanty (15.4k points) Use for this predefined magic constants __FILE__ and __DIR__: $dir = dirname(__FILE__) . '/'; or: $dir = __DIR__ . DIRECTORY_SEPARATOR; Please log in or register to add a comment.