Nodral Posted August 18, 2011 Share Posted August 18, 2011 Hi all I am trying to automate a process and need to know if it is possible to create an exe file which will run a php file for me. I've had a bit of a google, but as I don't understand command line stuff, I'll struggling to mae head nor tail of it. Any help would be appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/245108-execuatble-php-file/ Share on other sites More sharing options...
jjacquay712 Posted August 18, 2011 Share Posted August 18, 2011 If You are using Windows, you could create a batch script to run the php script for you. I'm a little rusty on it but if you open up a new file, paste this: @echo off php "C:\Path_to_your_script\script.php" and save it as a .bat file, you can double click it and it will run. Just make sure you have PHP installed. Quote Link to comment https://forums.phpfreaks.com/topic/245108-execuatble-php-file/#findComment-1258998 Share on other sites More sharing options...
Nodral Posted August 18, 2011 Author Share Posted August 18, 2011 I've tried this, and it runs fine when double clicked. However, I am trying to set it up as a rule in Outlook to perform an action when I receive an email each day. There is an error appearing in the command window but it pops up and closes so quick that I have no idea what the issue is. Any ideas how I can either slow it down, keep the window open or another method? Quote Link to comment https://forums.phpfreaks.com/topic/245108-execuatble-php-file/#findComment-1259007 Share on other sites More sharing options...
jjacquay712 Posted August 18, 2011 Share Posted August 18, 2011 Essentially what a .bat file does when it is run, is takes each line and runs it as a command in command prompt. What you could do for testing is just open up a command prompt window (Start > All Programs > Accessories > Command Prompt) and paste the line: php "C:\Path_to_your_script\script.php" The command prompt window will stay open so you can see any error that is reported. If you see any errors you can post them and I can try to resolve them. Quote Link to comment https://forums.phpfreaks.com/topic/245108-execuatble-php-file/#findComment-1259013 Share on other sites More sharing options...
Nodral Posted August 18, 2011 Author Share Posted August 18, 2011 I've sorted it cheers. I had to put an absolute path in to the php.exe file as the command prompt was running from witihin a system folder rather than from where the bat file was saved. Cheers for the help Quote Link to comment https://forums.phpfreaks.com/topic/245108-execuatble-php-file/#findComment-1259017 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.