I'm trying to get Doctrine 2 working with Codeigniter 2, and have come across a problem while trying to get Doctrine console up and running, which involves executing a shell script which runs a few lines of php.
I'm using this as a reference: Integrating Doctrine 2 with CodeIgniter 2
I'm new to OSX and new to unix commands but I'm confident I have set up the shell script properly as foll开发者_StackOverflow中文版ows:
#!/usr/bin/env php
<?php
chdir(dirname(__FILE__));
include('doctrine.php');
and I have the php file doctrine.php in the same directory.
Whenever I try to run the script with:
bash doctrine
I get this error:
doctrine: line 2: ?php: No such file or directory
doctrine: line 3: syntax error near unexpected token `dirname'
doctrine: line 3: `chdir(dirname(__FILE__));'
It looks to me like php isn't even running at all. I have the feeling I'm doing something fairly basic wrong!
Any help appreciated, Mark.
It's a PHP script, not a bash script.
php doctrine
If you meant for the shebang line to be used then you need to make it executable and run it directly.
chmod +x doctrine
./doctrine
精彩评论