PHP: mysql_connect() won't work via command line

后端 未结 7 1836
情书的邮戳
情书的邮戳 2021-01-17 15:37

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

7条回答
  •  不思量自难忘°
    2021-01-17 15:45

    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 :-)

提交回复
热议问题