Question

Hi I got a strange problem with my LAMP installation

I'm using an Ubuntu Server with PHP5 Apache and mySQL, all runs great when accessing via http.

But the thing is, I also want to trigger some scripts using bash, basically so I can trigger them at will and prevent them being used via Apache/HTTP

The scripts themselves run when called with php5, all includes are found. But for some unknown reason mySQL does not seem to initiate the Database the way it does via Apache. I just get a message back saying no database is connected.

Is there some special setup for bash related php calls?

Was it helpful?

Solution

Figured it out. There are no special DB settings for PHP run from Bash, However because I work on several Servers I was using the $_SERVER['HTTP_HOST'] variable to determin which login credentials should be used. Therefore it only worked on the server where the default credentials were correct.

For now I just put in an extra option in the code that uses credentials based on the value of the dirname(__FILE__) variable. Works great.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top