Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Running PHP Scripts From The Command Line Under Windows


I was wondering if anyone has ever tried running PHP scripts from the DOS command prompt. Any insight would be appreciated.




View Complete Forum Thread with Replies

Related Forum Messages:
Running A Windows Command Line From A Web Page
I have a web page on an intranet, i need to run a command in the local windows run from the webpage. for example when you press a button button on a webpage it has the same effect as running cmd from the run prompt on the local machine. Anyone know how to do this?

View Replies !
Running Php From The Command Line?
Do i have to make any changes to my php code which i currently run under IIS to be able to run the script from the command line?

View Replies !
Running PHP On Command Line & IIS Setup
I am trying to run PHP off of a IIS server....which hasn't be so pretty. I have included the path environment variable C:PHP, rebooted and started back up. Within C:PHP are two executables php-cgi.exe and php-win.exe. everything I have read online has said that all I need to do is point an environment path to this folder and everything should work. wrong!!!!

I try to run a script in dos and get php is not valid command error.....it's as if it isn't recognizing the command path. I have also set up php under properties to be opened by the CLI....so what am I doing wrong here? I'm running IIS 6 with a dedicated server.

View Replies !
Running Script From The Command Line
I'm trying to set up email piping on my server and I'm getting the following error back in my email:

/bin/sh: /var/www/vhosts/example.com/httpdocs/mailcontroller.php: /usr/bin/php
: bad interpreter: No such file or directory

I think the mail alias I set up in qmail is working correctly because when it wasn't I didn't get a script error back, just a user not found error.

From the error it sounds like it's not able to find php but I've tested a script from the command line to that path and it works fine (php is running as CGI btw, rather than CLI). I'm guessing that it's making it all the way to mailcontroller.php because I don't have the /usr/bin/php path anywhere else but in that file.  Could it be that it's actually running the script but can't get to stdin?

View Replies !
Accept Parameters When Running It Via Command Line?
how would I write a function so that it can accept parameters when running it via command line?

eg.

php -q email-script.php

and somehow pass an email address to that file?

is it possible to have the php file wait for keyboard input?

View Replies !
Keeping Window Open After Running Php File From The Command Line?
I was getting a 500 error and someone adviced me to run the php file
from the command line to check what errors that would come up with.

Great idea which I'd like to use, but when I use the Windows "run" box
to do this, I see a window open and close so quickly that there's no way
for me to read what's come up.

How can I force the window to stay open after the program has finished ?

Just in case it's needed, I run the tests on a Win XP machine with Apache.

View Replies !
[windows] PHP.GTK And Popuped Command Line
i compile php.gtk file with roadsend php compiler. Is here possiblity to
have windows program without starting command line window?

View Replies !
Running From Command Line - Warning:  Fopen() URL File-access Is Disabled In The Server Configuration
I'm trying to run a php script from the command line, but I'm having some difficulties. If I browse to my page in IE, my script executes properly, but if I run it from the command line, I receive this error:

Warning:  fopen() URL file-access is disabled in the server configuration in /www/public_html/update.php on line 21

Warning:  fopen(): failed to open stream: no suitable wrapper could be found in /www/public_html/update.php on line 21

I'm not sure why I receive errors when trying to run on the command line and not when accessing the page through a browser... My question is, can I open the page from a command line like a browser would??? I would like to make it a cron job, and currently I try "php update.php", but that receives the error... Is there a "http update.php" or a "get update.php" that would potentially do the same thing as a browser?

View Replies !
Is It Possible To Authenticate Users Running Apache On MacOS X (with PHP 4) And An Active Directory On Windows 2000 Or Windows XP?
From a PHP webpage, is it possible to authenticate users running Apache on MacOS X (with PHP 4) and an active directory on Windows 2000 or Windows XP?

View Replies !
CLI ( Command-line ) PHP Displaying Source Code In-line When Programis Executed
I'm using PHP 4.4.2, and use PHP on both the command-line and the web.

I am running PHP on SuSE 10 Linux , in a VMware 5.5 workstation, using
Apache 2.0.55 , on my Dell laptop. Everything has been running flawlessly
without problems. Very amazing to use VMware, it has worked beautifully.

uname -a

Linux xxxxxxx 2.6.13-15.8-default #1 Tue Feb 7 11:07:24 UTC 2006 i686 i686 i386
GNU/Linux

php -v
PHP 4.4.2 (cli) (built: Feb 7 2006 20:13:29)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

php -m

[PHP Modules]
bcmath
bz2
calendar
ctype
curl
dbx
dio
domxml
exif
ftp
gd
gettext
gmp
iconv
mcrypt
mssql
mysql
ncurses
openssl
overload
pcre
posix
session
shmop
sockets
standard
sysvsem
sysvshm
tokenizer
wddx
xml
yp
zlib

When I run the following program from the command line it prints out the
source code as well as the output from the program. I run other PHP programs
on the command-line and this doesn't happen. It's really peculiar. The
error output is below.

I copied this off of php.net, and have modified it only slightly to allow
command-line input. I was trying to find a CSV solution, which I ended up
finding elsewhere, but am curious why this program would error out the
way it does--have I misconfigured something? My php.ini is basically
unchanged, if at all. I think I might have set the path to mysql but that's
about it. When I run this program from the web it works without error.

<?php

if ( $argv[0] )
{
$file = $argv[0] ;
}
else{
$file = $_GET['file'] ;
print "<font face=arial>
" ;
}

$row = 1;

$handle = fopen("$file", "r");

while ( ( $data = fgetcsv($handle, 1000, ",") ) !== FALSE )
{

$num = count($data);

print "$num fields in line $row:<br>
";

$row++;

for ($c = 0; $c < $num; $c++)
{
print "$data[$c]<br>
" ;

View Replies !
Running SCP Command
Is it possible for me to use PHP to run SCP? I know that I can use exec() or system() or shell_exec() to run a command, but when running SCP you have to run the command, and then enter a password, so is it possible to do that? If so, how would I do it?

View Replies !
Running Shell Command Within Php
According to the manual for PHP, I should be able to run a shell command
within php.

I'm trying to copy some php files from one location to another one using
exec() but fail.

Code: ( text )

View Replies !
Running System Command
I'm using shell_exec to run a system command which should generate a file that i want to read, however the file isnt generated. I have safemode disabled and if i echo out the command and paste it into SSH the command executes fine. I have checked out the error log and there are no errors. This is an example of the command i'm running: Code:

echo 'passphrase' | /home/website/gnupg-1.4.2/g10/gpg -u JON --passphrase-fd 0 --clearsign --force-v3-sigs -o /home/website/temp_dir/8edef434308edfa0fd804cfd6d139512.asc /home/website/temp_dir/8edef434308edfa0fd804cfd6d139512.txt

I've tried executing this with system(), shell_exec() and popen() to no avail.

View Replies !
Ffmpeg Question Running A Command
Here is the ffmpeg command that you write in SSH

ffmpeg -i source.mpg -ab 56 -ar 22050 -b 500 -s 320x240 destination.flv

Works great, I have no problems. However I dont want to manually do this, I want to create a PHP page to do it from.

If I were to have a PHP file, what would I write for the PHP to execute the above command?

Because when I put: Code:

View Replies !
Script Running Under Command Prompt Or Browser Or Some Other Application?
I just out of curiosity want to know how top detect the client side
application under which the script is getting run. I mean to ask the
how to know whether the script is running under Command Prompt or
Browser or some other application?

View Replies !
Running PHP On Windows XP
I installed Apache/MySQL/PHP on Windows XP. There was one problem. Microsoft IIS 4 or higher was defaultly selected for MySQL. It did not work. When I double-click a PHP file, a lightning-fast MS-DOS window opens and closes. When I go to start, then go to run, then type "cmd", then type the PHP file path, I take a long time to see what happened.

I want my PHP file to work on my browser offline just like uploading and visiting my PHP file on a web host with my browser online. In other words, I want the interactivity of my site to happen in my computer. How can I do that?

View Replies !
Set Php Up On Apache Running On Windows.
Has anybody wrote a script or coded anything to set php up on apache running on windows.

View Replies !
Mcrypt Lib Running Under Windows
I need to use encryption functions with php, such as mcrypt_generic(), mcrypt_decrypt(), etc I have placed libmcrypt.dll in my windows/system32 directory. I can now encrypt, but not decrypt. The code I use to encrypt / decrypt functions under Mac OSX + Linux, but not Windows.

View Replies !
Possible To Check To See If Windows Process Is Running From PHP?
I need to check the state of a processes from within a PHP script on a
Windows machine. All I need to know is whether or not the process
exists (i.e., is running). Anyone have any ideas?

I searched the archives and found proc_open(), but if it can do what
I'm trying to do, I can't figure out how.

View Replies !
Copy Command Available In Windows?
Is the copy command available for use on a windows system. I have tried to run a script using it (taken directly out of a PHP manual) and am receiving a "parse error".

View Replies !
Run From Command Line
I just installed the latest version of PHP as an Apache Module. I'm wondering, how can I now run PHP from the command line? I heard there was a way without having to reinstall PHP to do this.

View Replies !
How To Use Php On The Command Line?
My question is how to use php on command line in windows

View Replies !
Command Line Or Not???
What's the best way to check whether script is run from command line or by
web server?



View Replies !
PHP Command Line (php.exe)
I am running WAMP Server on my computer, and I need to run a script with the PHP Command Line Interface... I've been doing some research and  so I tried entering the folowing command into the php command window: php -h, that is supposed to show a list of commands... nut it does nothing... nothing I try works... any ideas?

View Replies !
Command Line?
i'm currently running easyphp1.7 on win98. i've read that php4.3 comes with pear package installer but under windows this is not installed automatically. apparently you need the command line to install this? where do i find the php command line?

View Replies !
OOP In Command Line
I'm trying to write a fairly simple, easy to reconfigure php script which must be run from the command line, in this case, of a windows machine. I am defining my variables in a file called 'config.php' and i am requiring config.php at the top of the script (first thing i do). When i go to execute the script from the command line, it simply echos the contents of config.php in the command prompt.

View Replies !
Command Line
I need to run php script from command line for debugging. I also need to pass a GET string. How can I do this? I tried the following:

$> php index.php q=test

View Replies !
Command Line From PHP
Im really struggling with this. Ive searched the web, but I still cant find anything that works. Im running on Windows XP Pro, IIS, and PHP 5.0.2. I have a test.bat(its located in the local directory that Im running the PHP script from) file that contains:
Code: dir After searching around, Ive found a couple of people using exec() to execute a command. My php file: PHP Code:

echo exec('test.bat');
exec('test.bat', $output);
echo $output
//Im trying both examples to see if one of them works.

View Replies !
Having Problems Running Some Files On Apache For Windows
I am running Apache 2 for windows and have PHP installed and working fine on the server. However, some of the php scripts and programs i have do not use the <?php starting tag, the use <? instead, and as a result of this, the script does not execute.

Can anyone tell me how i can configure apache to allow both <?php tag and <? aswell?

View Replies !
Windows Program Command Exists
I can do this so easily in Unix: PHP Code:

$msg = exec('whatis convert 2>&1');
echo $msg;

However, in Windows using MS-DOS, I'm utterly lost. I am having to find out if ImageMagick is installed on a system for a function to operate (ImageMagick is required), and since this is a portable web application, you simply can't install ImageMagick everywhere you go.

Therefore I need to know if the system home has ImageMagick or not, and in Unix, I simply do a "whatis convert" and I can tell, but since MS-DOS has no equivalent to "whatis" I can't figure it out, and just running the "convert" command within a recursive function onto thousands of images is just not a good idea.

View Replies !
Problem Running Multi-line Sql From Php
I just want to insert a bunch of records into a table with fields, let's say, A and B. I can do this from phpAdmin with a statement like:

INSERT INTO table SET A=1,B=2;
INSERT INTO table SET A=9,B=24;

and so on which works fine. When I generate a similar query with a loop and create a variable $sql using something like Code:

View Replies !
Just One Line ! (exec Command)
I would most like to just get the first line from exec result. The last line just isn't what I want. When I use passthru it doesn't allow me to store the results in a variable, so that's no good.

View Replies !
Skip To Line Command?
Hello fellow PHPers. I've made a few posts in the past few days and really appreciate your help. Now i'm at the end of my project - getting a database submission/send email form to validate.

I get all the correct errors if the person doesn't enter certain fields, and the data doesn't submit. If they do enter all the required fields, it submits...

However, the code for when it doesn't submit reads...
if ($errmsg!= "") {
echo $errmsg;
} else {
the rest of the code
the rest of the html syntax

My problem is that if the error page comes up, the rest of the HTML doesn't get rendered because the PHP simply quits. Is there a command in PHP in terms of "Go To Line This in the document", so rather than exiting it would just skip the rest of the PHP but still print all the HTML. I thought of switching!= to == but the way in which that works fails as well. I'm thinking I might have to validate straight on the form rather than the submission page, but let me know what you know!

View Replies !
Talking To The Command Line
I have written a c program using Baltimores Encryption solution. I need to be able to access the executable from PHP but have not got the first clue how...
I simply need to pass the executable a string, and expect a string back. The whole function works on the command line, but, AGGHHH, how to i integrate it into PHP...
this is why i love ASP and COM URL.

View Replies !
Command Line Problems
I'm trying to use PHP as a command line executable, but I'm running into a few problems with passing in arguments, mainly, I can't.

I am using PHP version 4.2.3 and I have installed it with --enable-cli. I can run PHP scripts from the command line, no problem. However, no matter what I try, I can't seem to pass in variables and print out their values.

View Replies !
Newbie: How To Run Php From Command Line?
I need to test a script and want to do so on a Linux box (logged in via SSH from
another machine).

I tried creating a test script (called "test.php") like this:

#!/usr/bin/php
<?php
print "test";
?>

and tried running this from the command line like this:

../test.php

but nothing happens.

I also tried this:

../test test.txt

and the text in test.txt is this:

X-Powered-By: PHP/4.2.2
Content-type: text/html

Why is "test" not appearing in the test.txt file?

How do I get "test" to appear on my screen, rather than having to use test.txt?

Do I have to redirect STDOUT? How do I do this?


View Replies !
Command Line Tool
How do I get php to run a command line tool, in Windows Server 2003, and the
continue with the job in hand, is this possible?

View Replies !
Compiling Command-line
I'm trying to install a program (Cacti -- it queries for things like bandwidth usage, etc. every five seconds, and generates graphs from that data); however, it requires that it be able to run "php" from the command-line. (As opposed to through Apache.)

Is there an easy way to recompile PHP with its previous settings, but also configure it to allow me to invoke it from the command line? (If it matters; I compiled it initially with ApacheToolbox, but that's of no help to me for this.)

View Replies !
Command-line PHP Problem
I am trying to simply pipe in 2 very small commands and not have to
create a PHP script to do this:

Quote:

View Replies !
PHP Only Runs From Command Line
I know very little about PHP, but I was just curious to know
why exactly would some PHP code run fine from the command line but not
from the browser?

I'm just curious. I was working with someone else's PHP code that
supposedly created MySQL tables in a database and for some reason it
just wouldn't create the tables at all (no specific error message).
Someone suggested I run from the command line and when I did, it
worked...

View Replies !
PHP And Command Line (for Wiki)
I started to "program" in PHP (better say to read it :P) from a
few days because I am installing a Wiki on a virtual server (Windows
Server 2003 with Plesk 7.6). I have PHP5 and all is working just fine.

However, I am trying to parse latex equations and encountered some
troubles. I have already installed all the necessary software and when
I execute the following by command line:

C:miktexinlatex.exe --output-directory=C:Inetpubvhostsmysite.com
httpdocswikiimages mp --interaction=nonstopmode C:a.tex

I generate the right file in the right folder. However, when I try to
execute (adding it to a PHP routine that is executed for sure):

$command = "C:miktexinlatex.exe --output-directory=C:Inetpub
vhostsmysite.comhttpdocswikiimages mp --
interaction=nonstopmode C:a.tex";
$text = exec($command);

View Replies !
Reading From Command Line
I want to be able to have an infinite loop that is exited when the user types "q" on the command line. This is pretty trivial:

while(1)
{
    if (trim(fgets(STDIN) == "q")
    {
         exit;  }}


The loop however holds and waits for user input. I searched the php.net site and in the user comments I found this function: Code:

View Replies !
Using Functions On The Command Line
Is there some way I can run the time() function on the command line to quickly get the current timestamp? I have php 4.4.2 on Windows.

View Replies !
Execute Command Line
Is it possible to execute a command line from php and then post the data to a variable or array in php.

If it can be done i would be happy to see an example with "echo hello". I am running PHP5 on Linux.

View Replies !
Sql From A Command Line Sort Of
I have started an assignment for college, where I have to create a form to view fields from a MySQL database using PHP no problems there. The problem I have is another part of the assignment which requires me to be able to input a complete SQL command in via an input/textarea box. What the assignment has asked for is something similar to the SQL window as in PHPMyAdmin.

What I need to know is how do I parse a complete string such as - SELECT * FROM table WHERE clause = CONDITION. I know it's easy enough embedding SQL into PHP, I don't have a problem with that at all, what I think I need to find out is how to parse all the redundant characters in the string, spaces etc.

View Replies !
Command Line With Out Setup
I need to run a script under windows server 2003, this script is only needs to connect to mssql 3 times a day and do something. I cannot run a setup (it doesn't matter y), so I downloaded the latest php folder from php.net and put it in c:/php. I was able to run php from command line with no problems, but i cant seem to find the php.ini to enable the mssql componnents.

there is the php.ini-dist and php.ini-recommended renaming them wont help. any suggestions how to implement the php.ini without setup. BTW, i did not find any solution in the installation guide.

View Replies !
Command-line Interface
In the docs, it says the command-line executable (that allows you to run PHP scripts on your console as opposed to inside the web server) was introduced in 4.3.0. But I was told by someone that he can do command-line stuff with 4.1.0. Is anyone else using the command-line executable with a version earlier than 4.3.0?

View Replies !
PHP Arguments From The Command Line
I read somewhere a while back that arguments can be sent to a PHP 5 script through a cronjob via $_REQUEST in some format. I know that I could send them through 'argv' but what if the server configuration does not have "register_argc_argv" set? How would I setup the arguments on the command line to send them in with a key/value pairing that shows up in $_REQUEST?

View Replies !
Command-line Scripting
How do I set the maximum heap size for a php script run from the command-line?

View Replies !
Using A Script At Command Line
I'm way out of my depth on this one and I'm not even sure if it's possible.

I have a script that runs daily collating statistical data on widgets, and I'd love to have the server automate a post to a pnphpBB2 forum.

I've had a look at the source in the "post a new topic" page, and it seems that the "submit" button calls this:- Code:

View Replies !
Best Command Line Debugger
I'd like to be able to debug php scripts on the command line, going through the browser. In other words, set up the debugger to listen and then type in a url and have the code stop before displaying stuff to the browser. Then, step through each individual piece of code, etc, whilst having the output mirrored to either another file or the debugger
screen.

View Replies !
CGI Install Only Works From Command Line
I'm running Domino R5/Solaris 7/Intel. Any program will run on the command line, but from the browser i get "Document Contains no Data", any suggestions?

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved