The way I see it, you have three options.
/usr/bin/python
is actually a symlink to the python version that needs to be defaulted. You can simply resymlink that to python2.7 and you should be good on that front.
If you don't need python 2.6.6 then why keep it there. You can remove it.
Your second option is to alias python=/usr/bin/python2.7
in your bashrc file. This will default to python2.7 at all times.
Your third and final option, which is preferable over all the previous options is to use virtualenv
.
Virtualenv
will create a virtual environment container for you in your current directory. You can do your changes in that environment without affecting your system as other systemwide application might be using python2.6
. This is the best and safest option with the least amount of effort involved.
Be Careful:
The first two options are viable options but they are not good options as they require an assumption that your system does not need python2.6.
UPDATE
If you want an easy fix, at the beginning of your python script you can add the following shebang
#!/usr/bin/env python2.7
This will give you the ability to run that specific script under 2.7. My previous suggestions were on a system-wide basis. But if you only want it on one script, this should suffice. After you do that, make the script executable and simply execute it like any other executable by using ./test.py
To run your script from php, you will have to follow this post that gives you the snippet to be able to do it.