So I have tried everything I can think of to get this working. First of all this is NOT just an issue with 1 script, I have tried 3 or 4 of the scripts I normally use and I cannot get any of them to run on this server. I believe PHP CLI is working, both because I can run commands but also because I can see arguments required for php files without the keyword. PHP -v output
PHP 5.6.25 (cli) (built: Oct 21 2016 18:00:07)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
As you can see it spits out php version and cli. On my script itself I have added the following shebang at various times
#!/opt/rh/rh-php56/root/usr/bin/php
#!/usr/local/bin/php
#!/usr/bin/php
#!/usr/bin/env php
Finally if I try and run my script this is what happens.
[root@VM_0_5_centos misc]# ./english_to_chinese_dictionary.php
Usage:
english_to_chinese_dictionary.php server user password customer mappingFileLocation
Because of it outputting my "Usage" string I am pretty sure it is reading the file. If I however actually type all of the required arguments, then I get "No such file directory[root@VM_0_5_centos]" Every, single, time.
Bonus info, I have also run chmod 0777 on the file and I have tried setting the permissions to the correct user and running as root.
Any ideas?
Specifing the interpreter and running directly always brought problems to me. To check if it's a script problem rather than interpreter try removing all interpreter info, leave just
<?php //code....in it. Then run the script withphp -f filename.phpyou won't need any execution or write permissions on the file.I add that I usually prefer this way beacause it works perfectly on all platforms, including Windows PHP cli (obviously if the script is compatible)