glenelkins Posted March 16, 2010 Share Posted March 16, 2010 Hi I have XAMPP installed on my MAC. Which works perfectly fine. Though I need to run a script from the terminal. So I perform the following command: php -f /Volumes/Work\ HD/Projects/testProject/test.php In test.php it has code to connect to a mysql database. Which works fine when I run the script through the browser. But in the shell I get an error along these lines: Warning: mysql_connect(): [2002] No such file or directory (trying to connect via unix:///tmp/mysql.sock) in bla bla bla line 9 Link to comment https://forums.phpfreaks.com/topic/195422-php-script-from-command-line-mysql_connect/ Share on other sites More sharing options...
glenelkins Posted March 16, 2010 Author Share Posted March 16, 2010 ok i got this worked out. i was loading up the mac version of php rather than the xampp one do i need to keep the terminal window open for the script to execute or can I close it and leave it to do what is needed? Link to comment https://forums.phpfreaks.com/topic/195422-php-script-from-command-line-mysql_connect/#findComment-1026938 Share on other sites More sharing options...
FD_F Posted March 16, 2010 Share Posted March 16, 2010 you can use & example: php -f /Volumes/Work\ HD/Projects/testProject/test.php & then you can close the terminal Link to comment https://forums.phpfreaks.com/topic/195422-php-script-from-command-line-mysql_connect/#findComment-1026986 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.