I have a script which calls mysql_connect()
to connect to a MySQL DB. When I run the script in a browser, it works. However, when I run it from a command line
While it may be a rudimentary answer, make sure you have the most up to date PHP client, and make sure that it's looking at the same PHP folder that you're working out of through Apache.
If that doesn't work, try playing with mysqli and see if it's globally for the entire MySQL portion of PHP. If mysqli works and mysql_connect() doesn't, well, then, that's as good a time as any to swtich over to the OO side :-)