I have 1 file php: C:\\Xml2InDesign\\InDesignTagConverter.php
I exe it by:
$sjis_cmd="php \"C:\\Xml2InDesign\\InDesignTagConverter.php\";
exec($sjis_cmd, $output);
It not working. What do i must setting?
I run from cmd:
php "C:\Xml2InDesign\InDesignTagConverter.php" "c:\work\link2\\tmp\\5699\\direction.xml" "c:\work\link2\\tmp\\5699\\tables"
Show error: 'php' is not recognized...
Find your php.exe path and run command from there.
Like if your php.exe is in C:\PHP5\php.exe , then you can execute like this
C:\PHP5\php.exe "C:\\Xml2InDesign\\InDesignTagConverter.php\"
Refer this link
OR
if you want to run it through php code then use exec command
The PHP CLI as its called ( php for the Command Line Interface ) is called php.exe It lives in c:\wamp\bin\php\php5.x.y\php.exe ( where x and y are the version numbers of php that you have installed )
If you want to create php scrips to run from the command line that great its easy and very useful.
Create yourself a batch file like this, lets call it phppath.cmd :
PATH=%PATH%;c:\wamp\bin\php\php5.x.y php -v
Save this into one of your folders that is already on your PATH, so you can run it from anywhere.
Now from a command window, cd into your source folder and run >phppath.
Then run
php your_script.php
Related
Hello i have a PHP script, and its added to cron, it is possible to execute from this script shell command (with exec() or something) without enabling it on php.ini? I don't want to enable exec on my site
It's called PHP CLI, check here
Usually when you install php, there's option to install php_cli too.
So long you can run php on shell prompt, then it can work.
Open bash (or other shell), try this:
php -v
If the version printed, then it's working.
Then you can
php -f phpfile
or put
#!/usr/bin/php
At the beginning of your php file as a line, and chmod +x file.php, and then
./file.php
#or
/path/to/file.php
to run it.
(Note /usr/bin/php is the usual place of php executable, it might change, eg in unix is ually /bin/php. Use whereis php to check its place.)
I am trying to run a php file from shell script file or terminal in open-wrt platform. I have executed php files in crontab and those are running perfectly. i need to run a php file without putting it into crontab.I am trying it with the following command
chmod 777 /www/api/*
cd /www/api
php myphp.php
but it showing -ash: php: not found
I have also try it putting the following command on top of the script
#!/usr/bin/php
but it is not working. i could not figure out the problem!!!
You must install php-cli package, after you can run the script by
php-cli script.php
I'm getting an error in Magento:
One or more indexers are invalid
I tried this in the command prompt:
php bin/magento indexer:reindex
but when I do, I get this error:
I'm not familiar with Windows; I'm used to working on a Ubuntu terminal.
please check the Magento dashboard error below:
The PHP CLI as its called ( php for the Command Line Interface ) is called php.exe It lives in c:\wamp\bin\php\php5.x.y\php.exe ( where x and y are the version numbers of php that you have installed )
If you want to create php scrips to run from the command line then great its easy and very useful.
Create yourself a batch file like this, lets call it phppath.cmd :
PATH=%PATH%;c:\wamp\bin\php\php5.x.y
php -v
Save this into one of your folders that is already on your PATH, so you can run it from anywhere.
Now from a command window, cd into your source folder and run >phppath.
Then run
php bin/magento indexer:reindex
It should work like a dream.
just create your folder path and add "bin" directory For example :
c:\wamp\www\Magento2.0\bin>
and execute below command for reindex all indexes.
php magento indexer:reindex
I can run facebook.php script from ssh below:
cd /var/www/
php facebook.php
But I want to run to script 1 line command because i want to use it on cron. Like this:
php /var/www/facebook.php
I tried other commands on ssh but dont worked. Only first command is worked for me
if /usr/bin/php /var/www/facebook.php is not working, it might a case of your php path is different then /usr/bin/php.
i want to run a script PHP (example : http://localhost/project/test.php) from the command line without opening any browser.
i use the command :
START http://localhost/projetc/test.php
but this command opens a browser
do you have any solutions?
Find the path for your php.exe, and run it like this (make sure your run CMD.exe as an administrator):
C:\PHP5\php.exe -f "C:\PHP Scripts\script.php"
Refer to manual: http://php.net/manual/en/install.windows.commandline.php
path/to/php.exe path/to/script.php
Example if you're using xampp:
C:\xampp\php\php.exe C:\scripts\script.php