Executing PHP files from shell

fshagan

Verified User
Joined
Aug 2, 2011
Messages
6
Wondering what I'm doing wrong ... I have a script from CloudNS to copy DNS zones to slave name servers that starts with:

Code:
#!/usr/local/bin/php
<?php
// stuff here
?>
I'm getting the error:
-bash: ./directadmin-slave-zones-add.php: /usr/local/bin/php^M: bad interpreter: No such file or directory
/usr/local/bin/php does have a symlink to the PHP on my system, so I'm not sure what I'm doing wrong. Any help?

Server: CentOS 7
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
13,853
Location
GMT +7.00
Hello,

It seems you're working from a windows based text editor which adds \r\n instead of single \n breaklines.

I would suggest that you open the file in a Linux editor or correct settings of your editor to use only \n as line-break.
 

fshagan

Verified User
Joined
Aug 2, 2011
Messages
6
Thanks!

I am using Notepad++, but it was adding \r\n to each line. I'll have to find it in the settings. I removed the extra \r carriage return and got the script to work! It is syncing my DNS zones properly now.
 
Top