I installed xampp and put the php folder in my environment variable.
When I execute the "php filename.php" command, it always opens the interactive mode, it's the same with wamp.
Could someone help me? thank you
Related
I've been trying to run the php script:
shell_exec("bash /etc/example.sh")
from the browser but it does not work. This bash file creates a new one on the /etc directory.
I've also tried the functions exec() && system() but they don't work either. The weird thing happens when I run other Linux commands on these php function like:
shell_exec(rm -r /etc/fake);
they work fine, I have also tested my bash file on the linux command line and it works great.
I am sure this is not a permission issue, since I previously set the 777 permission on the file i am trying to execute.
shell_exec("bash /etc/example.sh")
I am using php7.0.33 and Debian 9, so I suppose this may be an issue with this PHP version 7.0.
Thank you for the help.
I have installed xampp in my windows OS.completed the configuration settings .But i can't run a simple php script from CMD . Is there anything should i do bfore running the script .
Be sure, that php is added to your path variable, so you can run php -v in your terminal. You should get the current version of your installed php.
If php was added to your path variable, you can run a php script like php file.php
See http://php.net/manual/en/faq.installation.php#faq.installation.addtopath
First, you have to go till that file path in command prompt then use command to execute php script,
php file_name.php
I am trying to run a php script locally placed under wamp folder in cygwin command line but getting the following error -
"-bash: php: command not found"
The Local Server I am using is WAMP.
The php.exe file is in the path C:/wamp64/bin/php/php5.6.24
and I am using cygwin in windows 10.
Any suggestion regarding this will be highly appreciated.
Many thanks in advance.
Ritaja
hey I want to run php on command prompt with xampp server. I made 2 environmental variables C:\xampp\php and C:\xampp\mysql\bin. how to execute the php code now?
Run command from console
c:\xampp\<path to php>\php.exe <path_to_your_php_project>\your_script.php
on my local machine I execute the following:
exec('sudo nohup '.PHP_BINDIR.'/php '.ROOT.'/index.php controller=imports action=import id=12 > /dev/null 2>&1 &');
where "ROOT" is a constant with the complete path.
Everything works fine and the script is executed asyncronously with no problems.
When I run the same script on production environment (a bitnami LAMP stack running on AWS) instead: if I run it directly from the terminal it works, when I run it from php it doesn't.
I have nothing in the apache error_log and if I run it with shell_exec the returned value is NULL.
If I try to execute a different script from php (like exec('whoami')) it works, so I don't think is a permissions thing.
I also tried replacing php command with php-cli, nothing changes.
Hope someone can help.
Thanks in advance.