dqc22586 2011-10-08 19:30
浏览 122
已采纳

PHP自动邮件......“没有指定输入文件。”

I have written a php file which sends email which is running via browser correctly. .I want to automatically send mails to user so i set up a job using "cron" after every 15 minutes

My php file name is "mail.php" and it is under folder "/public_html/myfolder/mail.php"

I have writen the command as

php -f /public_html/myfolder/mail.php

but it is showing error as "No input file specified."

so i tried using

/usr/local/bin/php -f /public_html/myfolder/mail.php

but the error was

"Could not open input file: /public_html/suvichar/mail.php

i have given the 777 permission to "mail.php"

can you please tell me what might be the issue can anybody give me exact command for cron to execute php file

  • 写回答

2条回答 默认 最新

  • douxiajiao8445 2011-10-08 21:28
    关注

    Normally public_html is located in the /var/www (or similar directory). For FreeBSD the location of public_html is /usr/home/<username>/public_html. You already stated you put execute permissions. For any one else looking to add execute permission on a file you run this at the command prompt:

     chmod +x scriptname.php
    

    Second you need to make sure you include the path to php at the top of your php file

     #!/usr/bin/php
    

    --- OR --- (FreeBSD) and for you according to your question

     #!/usr/local/bin/php
    

    When you call the cron job in your crontab file you use

     crontab -e
    

    Add this line to the file and save: 15 * * * * /absolute/path/to/mail.php

    # (This states that the script will run every 15 minutes everyday.)
    # ------------- minute (0 - 59)
    # | ----------- hour (0 - 23)
    # | | --------- day of month (1 - 31)
    # | | | ------- month (1 - 12)
    # | | | | ----- day of week (0 - 6) (Sunday=0)
    # | | | | |     * - Any day/month/hour
     15 * * * *     /absolute/path/to/mail.php
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大