Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


MySQL and PHP wont start on boot
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

MySQL and PHP wont start on boot

DeorDeor Member
edited September 2011 in General

Just noticed a couple of problems since one of my VM's was moved to a new node and had its IP changed. MySQL and php-cgi services dont seem to start to start on server boot up.

Its Ubuntu 10.04 32bit, OpenVZ

MySQL starts fine if i run 'service mysql start' but i cant get it to run a
boot still. Ive tried 'update-rc.d mysql defaults' which seems to complete ok,
it just doesn't have an effect!

PHP-CGI seems to be a little more odd. 'service php-cgi start' gives me an
error saying: Unable to open pidfile '/var/run/www/php.pid' for writing: No
such file or directory (No such file or directory)

If i go and create the www folder it starts, but everything falls over after a
reboot.

Any ideas?

Comments

  • Add a line

    mkdir -p /var/run/www; chown www-data.www-data /var/run/www

    in the init.d script for PHP

    And about mysql, I am not sure, but the init.d system is being deprecated at least in Ubuntu in favor of use upstart. I don't know how to use upstart :D If someone can illuminate us...

    Thanked by 1Deor
  • kiloservekiloserve Member
    edited September 2011

    For mysql, you may want to force remove prior to adding it back in.

    update-rc.d -f mysql remove
    update-rc.d mysql defaults

    You say this happened after an IP change, did you happen to hard-code the bind address for mySQL? If the above doesn't work, I'd check your config for the IP

  • @yomero said: I don't know how to use upstart

    Indeed. I'm too old to learn new tricks, which is why I am going back to Debian for now. However I think upstart should also start/stop sysvinit style scripts.

    For MySQL, also check /var/log/mysql/* for possible error messages in the logs.

    If all else failed, you can also just hack the start up script into /etc/rc.local :P

  • kiloserve said: You say this happened after an IP change

    Interesting, I didn't read that

    LowEndAdmin said: However I think upstart should also start/stop sysvinit style scripts.

    Apparently upstart was designed to be compatible with init

  • Thanks for the input guys, will do some more playing today and see what happens.

    Yes it was after an IP change due to moving to a node on a different subnet. I didnt even know you could set what IP MySQL was bound to till i started looking into this problem. Its set to localhost 127 address anyway.

  • I had this issue once, because I didn't have anything important in my vps I decided to reinstall the OS and install everything again. That "fixed" it.

  • carlosg said: I had this issue once, because I didn't have anything important in my vps I decided to reinstall the OS and install everything again. That "fixed" it.

    Windows solution FTW!

  • yomero said: Windows solution FTW!

    Exactly! LOL

  • kiloservekiloserve Member
    edited September 2011

    carlosg said:That "fixed" it.

    Lol. Do I detect a hint of "sarcasm"?

  • kiloserve said: Do I detect a hint of "sarcasm"?

    LOL. Yeah I was too lazy to find the proper solution :P

  • Well, for future reference, Yomero's fix for PHP was spot on and thanks to the very helpful folks at bHost who fixed mysql for me via the last post in this thread.

    http://www.howtoforge.com/forums/showthread.php?t=47926

    Hope someone finds this useful in the future, probably me in a few months :)

  • Weird! Never happenned to me. Maybe an issue with that specific Ubuntu version?

  • I had similar problem on Oneiric on OpenVZ vps but I haven't this problem on my XEN vps.

  • Just for the hell of it I tried a fresh load and install of everything, did the same thing again. Must be something to do with the ubuntu all.or minimal image, as I'm sure the LAMP image didn't have this problem. Will try it on one of my other VM's sometime too.

Sign In or Register to comment.