Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>After a lot of tinkering myself, I've found a way! </p> <p>In your php script, you should set timeout limit to <code>0</code>, and have a infinite loop, like that:</p> <pre><code>&lt;?php set_time_limit(0); while (true) { print "blah\n"; sleep(120); } </code></pre> <p>This code will print out "blah" every 2 minutes.</p> <p>To deploy this to AppFog, you <em>must</em> use the <code>af</code> console command. The big thing here is to say <strong>no</strong> when it asks if that's a PHP app.</p> <h2>The steps</h2> <ol> <li><code>af push</code> on the directory</li> <li>say <strong>no</strong> if it guesses the language of your app</li> <li>Select <strong>Standalone</strong> as the app type.</li> <li>Now you select PHP</li> <li>Enter <code>php index.php</code> or whatever name you gave to your application main file.</li> </ol> <p>It's all shown below:</p> <pre><code>D:\Users\Leonel\dev\app&gt;af push Would you like to deploy from the current directory? [Yn]: Application Name: APP Detected a PHP Application, is this correct? [Yn]: n [...] 6: Standalone [...] Select Application Type: 6 Selected Standalone Application [...] 5: php [...] Select Runtime: 5 Selected php Start Command: php index.php 1: AWS US East - Virginia [...] Select Infrastructure: 1 Application Deployed URL [None]: Memory reservation (128M, 256M, 512M, 1G, 2G) [128M]: How many instances? [1]: Bind existing services to 'APP'? [yN]: Create services to bind to 'APP'? [yN]: Would you like to save this configuration? [yN]: Creating Application: OK Uploading Application: Checking for available resources: OK Packing application: OK Uploading (0K): OK Push Status: OK Staging Application 'APP': OK Starting Application 'APP': OK D:\Users\Leonel\dev\APP&gt;af logs APP ====&gt; /logs/stdout.log &lt;==== blah blah </code></pre> <h2>Some Notes</h2> <ul> <li>You need to create a <em>separate</em> app to perform the background tasks, though this app can be binded to the same services (e.g databases) of the other apps or this app can <code>curl</code> to your other app, for example. Just make sure it's on the same availability zone.</li> <li><code>af logs APP</code> will give you the output of the worker, so you can debug and check if everything is ok.</li> </ul> <p>That's it, hope it helps.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload