How would I execute a PHP command?
-
- User
- Posts: 78
- Joined: Sun Apr 24, 2005 3:22 am
How would I execute a PHP command?
I am trying to think about ways to execute a PHP file or command silently. Any suggestions?
Code: Select all
RunProgram("php.exe", "filename", "c:\diroffilename\", 1|2)
-
- User
- Posts: 78
- Joined: Sun Apr 24, 2005 3:22 am
im not reatarded, and I know PHP
here is what im talking about...
for example if i somehow tell purebasic to execute:then i wish for it to execute the code, and create the .txt file. I don't want to do that exactly, but that's what I mean
here is what im talking about...
for example if i somehow tell purebasic to execute:
Code: Select all
<?PHP
$f=fopen("whatever.txt","w");
echo fwrite($f,"C:\TestFile.txt");
fclose($f);
?>
If you have PHP installed, if your webserver are properly configurated and if this PHP code its okay, should work fine.
One question: you need to do it in PHP?
I mean, if you are using a PB coded webbrowser, you can do the same without using PHP and will be easier and your distributable file will be smaller since dont need PHP.
One question: you need to do it in PHP?
I mean, if you are using a PB coded webbrowser, you can do the same without using PHP and will be easier and your distributable file will be smaller since dont need PHP.
ARGENTINA WORLD CHAMPION
PB dont execute PHP.roachofdeath wrote: for example if i somehow tell purebasic to execute
If you have PHP installed, and configure your web server fine, when it receives a call to a .php page, it will sent it to PHP.exe on your computer and only receive the result from php.exe and send it to the client.
Its the same as a CGI, the server call the appropiate executable to interpret the code and receive the response (code already interpreted) from .exe
ARGENTINA WORLD CHAMPION
You could execute your example code snippet
Test.php
by using PB-Runcommand even without running a webserver. Just try
to execute the php.exe like this :
That would execute above's PHP-Code.
To get the output (i.e. the result of fwrite) you could use the
following:
Test.html now stores the output of the "echo fwrite()" command.
Maybe this info is of some help for you

Test.php
Code: Select all
<?PHP
$f=fopen("whatever.txt","w");
echo fwrite($f,"C:\TestFile.txt");
fclose($f);
?>
to execute the php.exe like this :
Code: Select all
[pathTOphp]/php.exe -q -f Test.php
To get the output (i.e. the result of fwrite) you could use the
following:
Code: Select all
php.exe -q -f Test.php > Test.html
Maybe this info is of some help for you


regards,
benny!
-
pe0ple ar3 str4nge!!!
benny!
-
pe0ple ar3 str4nge!!!
-
- User
- Posts: 39
- Joined: Fri Mar 26, 2004 1:47 pm
- Location: London, UK
- Contact:
hey roach,
I assume you are calling php from commandline (not in a browser).
Not many folks use php this way but it's great. I converted a bunch of VB file/mail processing applications to php and they run about 8 times faster.
If you aren't using commandline php then do it, and refer to Jellybean's post above.
EDIT : looks like Benny types faster than me
I assume you are calling php from commandline (not in a browser).
Not many folks use php this way but it's great. I converted a bunch of VB file/mail processing applications to php and they run about 8 times faster.
If you aren't using commandline php then do it, and refer to Jellybean's post above.
EDIT : looks like Benny types faster than me
well in fact things could be done anyway if he has a queue list, then he'll be able to process every "client" and have the other awaiting till that one is done, then the next one, on the barber shop to get that fancy new cut he wanted! - Depends on what hes going to programm though.
I guess that now hes able to do what he wanted - why speculating?
I guess that now hes able to do what he wanted - why speculating?
-
- User
- Posts: 78
- Joined: Sun Apr 24, 2005 3:22 am
Roach, have you checked out my 'php brew' code here on the forums?
viewtopic.php?t=13982&highlight=
Does this help?
viewtopic.php?t=13982&highlight=
Does this help?