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
    • 58
    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:

            print "hi world";
           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

Sign up using

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: