I have a php file called sample.php with the following content:
<?php
echo "Hello World!";
?>
And what I want to do, is to run this php script using a second php script.
I think shell_exec could help me, but I don't know its syntax.
By the way, I want to execute this files with cpanel. So I have to execute the shell.
Is there any way to do this?
If you need to write a php file's output into a variable use the ob_start and ob_get_contents functions. See below:
So if your 'myfile.php' contains this:
Then your output will be: