I've got a custom virtual machine base box that has PHP, Apache2 and MySQL pre-installed. So I can just boot up the virtual machine using this box and it wont need to install any of the above from Chef Cookbooks.
However, there is one Chef Cookbook I'm trying to install, but it's failing. The Cookbook I'm trying to install runs a PHP script, which connects and uses a MySQL db.
The reason it fails is because PHP cannot connect to the mysql server. I think it's because MySQL isn't started (or ready) at the time the script tries to connect. It only fails when I boot the VM. When I provision it (vagrant provision), it works. So that's why I think MySQL isn't ready to go when the PHP script attempts to connect.
The errors:
mysql_connect(): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in .....
And the code in the Chef Cookbook Recipe:
execute "doInstall" do
cwd "/vagrant"
command "php path/to/my/script.php"
end
Any ideas?