Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to get any File Name to PHP File using Command Line?

    • 0
    • 1
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 181
    Comment on it

    In Ubuntu system, first check for the PHP. For checking open the terminal, using command

    **Ctrl +Alt +T**
    

    and type whereis php

    If PHP present in system, above command display the path of PHP

    Make a PHP file from where you can access it:

        <?php
            print "hi world";
            echo"<pre>";print_r($_GET);echo"</pre>";
           echo $File = $_GET['file_name'];
    // use the file name and do whatever you want to do with it.
        ?>
    

    open the file in the command line, by using below command:

     **php-cgi -f /var/www/test/filename.php file_name=qwer.csv**
    

    Output on the Command Line is like:

     **hi world<pre>Array
    (
        [file_name] => file.csv
    )**
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: