We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9207 ☆ A M B ☆
    • 2,475 Posts
    Anyone doing MODX dev on a Virtual Box or on VMware? I've got the server up and I can run php etc... but I can't get through the setup. Here's the error I'm getting:

    Connecting to database server:  
    Could not connect to the database server. Check the connection properties and try again.
    
    [2013-02-10 15:06:16] (ERROR in xPDOConnection::connect @ /mnt/hgfs/mysites/modx_revo/html/core/xpdo/xpdo.class.php : 2999) SQLSTATE[HY000] [2002] No such file or directory 


    The file IS there... but I worry that the sharing of directories between the VM and my host OS might be weirding out PHP...
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      That is more likely an issue with being able to find the database engine. Is the database engine running in your VM or on the host OS? Is the database engine using sockets or IP?

      On Unix, MySQL programs treat the host name localhost specially, in a way that is likely different from what you expect compared to other network-based programs. For connections to localhost, MySQL programs attempt to connect to the local server by using a Unix socket file. This occurs even if a --port or -P option is given to specify a port number. To ensure that the client makes a TCP/IP connection to the local server, use --host or -h to specify a host name value of 127.0.0.1, or the IP address or name of the local server. You can also specify the connection protocol explicitly, even for localhost, by using the --protocol=TCP option

      http://dev.mysql.com/doc/refman/5.5/en//connecting.html
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 40447
        • 165 Posts
        Did you check $_SERVER["DOCUMENT_ROOT"] ? It is based on your virtual host directory definition in php.ini.
        Besides that,
        did you virtualize an os too, including modx and the server, or just virtualized modx and kept the server on your host os ? To avoid sharing problems, I had no problem when I setup a virtual windows xp and then installed xampp and modx inside that virtual xp. In your case maybe you have to check your hosts file on the host os. http://www.tildemark.com/setting-up-virtual-hosts-with-xampp-running-on-windows-xp This might help too http://stackoverflow.com/questions/3375114/running-xampp-on-windows-through-vmware-fusion-on-a-mac-how-do-i-configure-apac or this,
        http://www.donationcoder.com/forum/index.php?topic=17096.0
          • 9207 ☆ A M B ☆
          • 2,475 Posts
          Everything is running on the VM -- it's running CentOS, and the MySQL instance is also running on the VM. If I log into MySQL via the command line, it understands a host of "localhost", e.g. this works:

          mysql -umyuser -p -hlocalhost modx_db


          The webroot is defined inside my httpd.conf file -- I'm not using virtualhosts on this yet, I'm just navigating to the VM's IP address (it's running in Bridged mode, so it gets its own IP address).

          I did get a more specific error (which I think illustrates exactly what Susan mentioned):

          Fatal error: Class 'xPDODriver_' not found in /mnt/hgfs/revo/html/xpdo/xpdo.class.php on line 1823


          I could manually write the config file at this point... but I'm worried if the setup doesn't complete normally, I may be missing something.
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            This may be completely redundant, but are you sure your PHP has the proper PDO drivers enabled?
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 9207 ☆ A M B ☆
              • 2,475 Posts
              I think so... it's got "--with-pdo-mysql" in the config, and a phpinfo() shows the pdo_mysql and the usual stuff, but it doesn't look exactly like the working phpinfo() statements from my MAMP setup. Here's a screenshot:

              http://www.screencast.com/t/6onZYJD8F

              Odd is the "Client API Version". On my CentOS VM, it lists it as "mysqlnd 5.0.10 - 20111026 - $Id: b0b3b15c693b7f6aeb3aa66b646fee339f175e39 $" whereas on MAMP, that same field prints a simple version number: "5.1.44".

              At some point I got an error re php_network_getaddresses... so maybe I should stop being lazy and set up a virtualhosts conf file. It's just a bit hard to set up because each time my computer gets a new IP address from the router (e.g. if I go to the coffeeshop), then I'll have to edit the conf file... but that's down the road a bit...