This Season
 

How to Execute a PHP File in Linux

PHP is often thought of as a Web developer's language, with the files being executed by a Web server. However, it can also be used as a shell scripting language to create scripts that are executed on a local machine from the command line. Like other command line scripting languages, such as Perl or Bash, it can be used for logging purposes and system administration tasks.

Related Searches:
    Difficulty:
    Easy

    Instructions

      • 1

        Download and install PHP through the distribution's software repository, if it is not already installed. Ubuntu and Debian users will use the "Synaptic Package Manager"; Fedora and Mandriva users will use the "Add/Remove Programs" application; OpenSuse users will use the "Yast" application. You can also download the PHP source code directly from the PHP website (See the link in the Resources section). Many distributions have PHP installed by default.

      • 2

        Open a terminal window. The terminal window can be found under "Accessories" or "Utilities" in the main "Applications" menu.

      • 3

        Type the command "cd <php_directory>" to change to the directory that contains your PHP file. Replace "<php_directory>" with the correct directory name.

      • 4

        Type the command "php <file.php>" to execute the script. Replace "<file.php>" with the exact name of the script.

      • 5

        Type the command "Exit" to leave the terminal session.

    Related Searches

    References

    Resources

    Read Next:

    Comments

    You May Also Like

    Follow eHow

    Related Ads