91737/how-to-get-the-home-directory-from-a-php-cli-script
From the command line, I can get the home directory like this:
~/
How can I get the home directory inside my PHP CLI script?
#!/usr/bin/php <?php echo realpath(~/); ?>
Hello @kartik,
You can fetch the value of $HOME from the environment:
<?php $home = getenv("HOME"); ?>
Hope it helps!!
Thank You!!
Hello @kartik, You could use the copy() function : // Will ...READ MORE
Simply, $source = 'Source_file_location' ...READ MORE
Hello @kartik, Use the php_sapi_name() function. if (php_sapi_name() == "cli") { ...READ MORE
Hello @kartik, __CLASS__ always returns the name of the ...READ MORE
Hey @kartik, First you have to go to ...READ MORE
Named route is used to give specific ...READ MORE
Hello, This is simple you just need to ...READ MORE
Hey @kartik, Named routing is another amazing feature of ...READ MORE
Hello @kartik, You'll be wanting to use glob() Example: $files = ...READ MORE
Hello @kartik, Try $_SERVER['DOCUMENT_ROOT'] contains this path: D:/workspace In that case you ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.