Changes
Title
unchanged
Things to Consider when application hosting on AppFog
Category
unchanged
Tips
Yii version
unchanged
Tags
unchanged
appfog, user session, remote host, ip address
Content
changed
I faced many issues when hosted our company website on AppFog.
## Problems:
+ No CRON, service to schedule automated tasks
+ PHP's `mail()` function is disabled
+ Server load balancer IP instead of User's IP
+ All Logged in user's session outs automatically
+ Yii Assets Manager don't publishes every thing correctly, Some time for same files Apache/Yii reports 404[...]
Your should consider these things to get up and running application without lack...
### No CRON, service to schedule automated tasks
They don't provides CRON service to schedule automated back-end tasks.
Don't worry, it doesn't mean you won't. There are some third party service like IronWorker etc which supports CRON like tasks. Or you may write your own in Ruby or Python language. Read here: [Time for Cron in PHP Fog](https://blog.appfog.com/time-for-cron-in-php-fog/ "Time for Cron in PHP Fog").
But the bad thing is a PHP developer should know either Ruby or Python for Task scheduling service. Or write a PHP programme which executes lines of code continuously into a infinite while loop. Which wake-up after duration of `sleep(10)`.
e.g:
```php
while(true) {
// Write for scheduled task, like sending email service
// or calculate article relevancy score
sleep(10); // Sleep to 10 seconds after every execution
}
```
### PHP's `mail()` function is disabled
WTF? Really, then how will send emails. Hmmm, it's a really big issue. If your web application needs some email shooting then use other library like PHP-Mailer and connect through SMTP toother services like GMail and send emails. Or you may use MailGun. Read more [here](http://www.yiiframework.com/wiki/794/mailgun-api-wrapper-to-send-emails/ "MailGun Api Wrapper to send emails") about sending emails through MailGun.
### Get User IP Address
Fix: `Server load balancer IP instead of User's IP`
```php[...]