Help needed with Cron job path

software development


I’m trying to set up a cron job and I’m using one from another user that is currently working well and does exactly what mine is supposed to do. My path is the exact same path as the working one I copied, but with a different user, of course. But I keep getting an error message that says, “Could not open input file: /home/my_username/selahapi.php”

I have the following in the path description:
usr/local/php5/bin/php /home/my_username/selahapi.php but it’s just not working and I can’t figure out why it doesn’t. The file is located behind my user folder when I use ftp (I believe it’s called a “backend” file.

Any help is appreciated.



I’m assuming a typo in the path to php since you’d have gotten a different message I think…

  1. Check permissions should be 700 or at least 500
  2. Shell in and check that the file exists and you can run the command from your home directory “/usr/local/bin/php -l ~/selahapi.php” . -l is the syntax check option.
  3. Only if you edit on a DOS/Windows system run “dos2unix ~/selahapi.php”. Normally you’d get a different error if this were the issue though
  4. I had some weirdness with files that were bigger that 1k in characters. Weird because I’ve used larger scripts before but for this particular script I had to break it into two crons but that’s a different error message as well “/bin/sh: -c: line 0: unexpected EOF while looking for matching `’’”



I changed the permissions of the file from 644 to 700 but it didn’t make any difference.
I’m on a Mac and not a windows system
I tried to do #2 but couldn’t seem to even log in to do anything. I did the “ssh email address” and it asked for my password, but it would never accept my password, even though I know that it was the right password (I even went back to manage users in the control panel and entered the password into the user again, but it didn’t make any difference).
I’ve put a tech support request in and hopefully we’ll see what’s going on with this thing.



For me testing this would include…

Login via SSH/Shell
Vim or nano foo.php
Type <?php phpinfo(); ?>
chmod 700 foo.php
php ./foo.php

If you get a bunch of info about PHP settings then you should be golden.

Then you just need to figure out what’s the issue with your script.



Well, I sincerely appreciate the advice and counsel. However, I guess I’m not versed enough in this to understand foo or vim or nano. I guess I’ll just have to wait till I hear from support.

But, thank you for trying to help me.



foo is just a programming convention meaning temporary so in the above context foo.php is a temporary file so it can be named anything.

vim and nano are text editors you can use in the shell here on dreamhost.

vi/vim are hard to use if you’re just starting out so nano is provided for quick edits.



Thanks for helping me understand a little more.

I’ve heard from tech support and it appears that my permissions were such that I was trying to access a file that belonged to another user (even though that other user was me - but nevermind about that). I made a couple of changes and voila, it started to work as it was supposed to work.

And, I also discovered that the reason I couldn’t shell into the account was because I wasn’t using the “username@domain” but was using my email address@domain. I didn’t realize that the username@domain didn’t need to be a valid email address that I had set up, but was merely to be the user@domain. So, that’s why my password didn’t want to work. But. . . we’re good now.

Thanks again for your taking the time to help me. It’s appreciated!