0

I have a php file push.php to send push notification. I can run this php file from browser http://myserver.com/push.php and it sends push notification properly. I want to run this push.php automatically after 10 minutes.

My server is Linux shared server from bluehost.com. php version 5.4.39. So I choose cron job feature in cpanel. I have insert my mail so when push.php run / cron works and I receive mail.

I followed https://my.bluehost.com/cgi/help/168 and set time 10 minute and command php -q /home2/applusme/public_html/pushfolder/push.php where /home2/applusme is showing beside home icon and pushfolder is folder. I received mail but push is not sending.

I tried many ways but push not sent. below is push command and what i get in mail body from Cron Daemon <[email protected]>

  1. php -q /home2/applusme/public_html/pushfolder/push.php

mail content: <script type="text/javascript">window.top.location.reload();</script>

  1. wget http://myserver.com/push.php

mail content:

`http://myserver.com/push.php
Resolving myserver.com... 62.59.23.60
Connecting to myserver.com|62.59.23.60|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: “push.php”`

3. /usr/local/php5/bin/php5 /home2/applusme/public_html/pushfolder/push.php

mail content: /usr/local/cpanel/bin/jailshell: /usr/local/php5/bin/php5: No such file or directory

  1. cd /home2/applusme/public_html/pushfolder; /usr/local/php5/bin/php5 -q push.php

mail content: /usr/local/cpanel/bin/jailshell: /usr/local/php5/bin/php5: No such file or directory

  1. curl http://myserver.com/push.php mail content:

    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                             Dload  Upload   Total   Spent    Left  Speed
    
    0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
    100    72    0    72    0     0    132      0 --:--:-- --:--:-- --:--:--   133
    
  2. php /home2/applusme/public_html/pushfolder/push.php mail:

     Set-Cookie: PHPSESSID=ds4glu5kcbtu0tg95orkn2uci7; path=/
     Expires: Thu, 19 Nov 1981 08:52:00 GMT
     Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
     Pragma: no-cache
     Content-type: text/html
    
    <script type="text/javascript">window.top.location.reload();</script>
    

I have spend more than 5 hours in this issue but no luck. Please suggest me what can I do.

Thanks in advance

8
  • Are you sure push is working fine? I mean push.php is able to do his all functionality? Commented Apr 7, 2015 at 11:06
  • /usr/local/cpanel/bin/jailshell: /usr/local/php5/bin/php5: No such file or directory Did you set the right PHP path for the cron user ? Commented Apr 7, 2015 at 11:06
  • yes, push is working fine. all required settings for sending push notification are implemented into push.php and I am getting push notification into my android phone and iPhone both Commented Apr 7, 2015 at 11:08
  • 1
    Note that sessions and javascript will not work when you use cron as there is no browser involved. Commented Apr 7, 2015 at 11:09
  • @AkramFares, I don't know how to set right PHP path for the cron user.Will you please help me Commented Apr 7, 2015 at 11:09

1 Answer 1

1

I found the problem from @jeroen help. I have included include_once('includes/dbconfig.php'); into my push.php. There was javascript code into dbconfib.php. I removed javascript code and it works fine.

Thank you all

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.