I am trying to execute a file from terminal generated by PHP. When i manually type the file, its executing the perfect. But when it is generated by PHP program, it throws an error.

The permission of both files are same.

I have attached image with error in terminal. The code is related to import of MySQL database to ElasticSearch Cluster.

enter image description here

2 Answers 2


Check for trailing spaces after the terminal backslashes \.

There should not be any!

  • Yes, I did that, file comparision, its 100% match. still couldnt
    – Rafee
    Commented Jul 7, 2015 at 19:38
  • windows endline then, reopen file with gedit and save with LInux/UNIX endline
    – czapa.ols
    Commented Jul 7, 2015 at 19:47
  • I am linux environment.
    – Rafee
    Commented Jul 7, 2015 at 19:51

If the permissions are indeed the same, run this:

diff -c normal.script php-output.script

File names are self explanatory I believe.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .