how to execute php as batch file and execute it

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sobha
Forum Commoner
Posts: 56
Joined: Wed Jul 15, 2009 9:08 pm

how to execute php as batch file and execute it

Post by sobha »

Hi,

how to execute php as batch file and execute it?

Regards,
Sobha
ocpaul20
Forum Newbie
Posts: 12
Joined: Thu Jul 05, 2007 3:53 am

Re: how to execute php as batch file and execute it

Post by ocpaul20 »

what system? in linux I use this in a shell script every day and it seems to work OK, but of course you have to have php installed for it to work. (obviously you place your relevant details between the { } below)

{path to php} -f (path to your phpfile you want to run} -c {path to php.ini configuration file}
sobha
Forum Commoner
Posts: 56
Joined: Wed Jul 15, 2009 9:08 pm

Re: how to execute php as batch file and execute it

Post by sobha »

what about in Windows?
ocpaul20
Forum Newbie
Posts: 12
Joined: Thu Jul 05, 2007 3:53 am

Re: how to execute php as batch file and execute it

Post by ocpaul20 »

I think I used the windows scheduler and I tried out the commands at the cmd prompt first to make sure they worked. I have a feeling it needed quotes around the {your phpfile} part, but it was a while since I did it. I will try and look it up if I remember and if you dont get any others chipping in to answer it better than I can.
sobha
Forum Commoner
Posts: 56
Joined: Wed Jul 15, 2009 9:08 pm

Re: how to execute php as batch file and execute it

Post by sobha »

Hi

I used echo exec('C:/start.bat'); to execute the batch file.But it is not showing the output.

Please help.

Regards,
Sobha
Post Reply