Sir/Mam How can i run any php files through xampp in cammand line prompt??Plzz help!!
how to run .php files in xampp in cmd
Collapse
X
-
You want to run PHP files through XAMPP, but in a CMD prompt window? That makes no sense.
You can use the Program Execution Functions to execute commands from PHP, so if you wanted to run PHP files written for command line prompts from a website PHP file, you could try doing that with, say, the shell_exec function.
Code:<?php // Create the command to execute the PHP file. // (Adjust the paths as needed!) $filePath = "/usr/bin/php /var/scripts/cmd_line_script.php"; // Execute the command and capture the results. $result = shell_exec($command); // The result will be NULL if it failed, otherwise it'll be a string. if ($result) { echo "<pre>{$result}</pre>"; } else { echo "<strong>Failed to execute PHP script.</strong>"; }
Comment