Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
oil refine migrate to remote server
  • I know that by using oil migrate will automatically upload the tables for you in the database on local server (computer localhost) but I can't seem to get to work with my remote server. 

    I am currently using 3 different computers because I move around a lot and I keep all of my files in dropbox to keep them in sync but I do have a domain website that I would like to upload and work from my remote server. I can upload the files and everything but I can't get the oil to migrate or generate tables in my remote database. Is there an easier way of doing this? I have been trying to figure this out for the last few days as I am learning FuelPHP, which seems to be awesome framework so far, and I am getting frustrated. Any help would be greatly appreaticated!! 
  • There is no perfect solution.

    If you have access to the remote database server (you can connect to it from other than localhost) then you could setup a test environment db config and run this: FUEL_ENV=test oil r migrate


    But this is rather an ugly workaround than a solution.
  • There is no perfect solution.

    If you have access to the remote database server (you can connect to it from other than localhost) then you could setup a test environment db config and run this: FUEL_ENV=test oil r migrate


    But this is rather an ugly workaround than a solution.
  • What do you recommend for setting up tables in remote database? Is there another way?
  • Another thing I noticed was that Oil have few new features added in Usage and one of them was server and I cannot find any documentation on how to config it because it seems to be connecting to my localhost rather than my remote server and when I ran '$ php oil server help', it returned information of server that is listening on. I don't know if this has to do anything with me trying to generate tables in my remote database. 

  • it starts a local built-in PHP server, so you can use Fuel without having a webserver ready. It doesn't have any options, other then serving your index.php.
  • This is what I was referring to in my last post. 

    $ php oil

    Usage:
      php oil [cell|console|generate|package|refine|help|server|test]

    Runtime options:
      -f, [--force]    # Overwrite files that already exist
      -s, [--skip]     # Skip files that already exist
      -q, [--quiet]    # Supress status output
      -t, [--speak]    # Speak errors in a robot voice

    Description:
      The 'oil' command can be used in several ways to facilitate quick development, help with
      testing your application and for running Tasks.

    Environment:
      If you want to specify a specific environment oil has to run in, overload the environment
      variable on the commandline: FUEL_ENV=staging php oil <commands>

    More information:
      You can pass the parameter "help" to each of the defined command to get information
      about that specific command: php oil package help

    Documentation:


    I ran the oil server help to get more information and this is what came back. 

    $ oil server help
    Document root is public/
    Press Ctrl-C to quit.
    Directory public/ does not exist.
  • However when I tried to oil refine migrate this is what I get:


    $ oil refine migrate
    Uncaught exception Fuel\Core\Database_Exception: SQLSTATE[HY000] [1045] Access denied for user 'enigmama_MD'@'localhost' (using password: YES)
    Callstack:
    #0 C:\Users\jmoakley\Dropbox\MoakDesigns\fuel\core\classes\database\pdo\connection.php(170): Fuel\Core\Database_PDO_Connection->connect()
    #1 C:\Users\jmoakley\Dropbox\MoakDesigns\fuel\core\classes\database\query.php(263): Fuel\Core\Database_PDO_Connection->query(1, 'SELECT * FROM `...', false)
    #2 C:\Users\jmoakley\Dropbox\MoakDesigns\fuel\core\classes\dbutil.php(587): Fuel\Core\Database_Query->execute(NULL)
    #3 C:\Users\jmoakley\Dropbox\MoakDesigns\fuel\core\classes\migrate.php(590): Fuel\Core\DBUtil::table_exists('migration')
    #4 C:\Users\jmoakley\Dropbox\MoakDesigns\fuel\core\classes\migrate.php(74): Fuel\Core\Migrate::table_version_check()
    #5 [internal function]: Fuel\Core\Migrate::_init()
    #6 C:\Users\jmoakley\Dropbox\MoakDesigns\fuel\core\classes\autoloader.php(364): call_user_func('Migrate::_init')
    #7 C:\Users\jmoakley\Dropbox\MoakDesigns\fuel\core\classes\autoloader.php(247): Fuel\Core\Autoloader::init_class('Migrate')
    #8 [internal function]: Fuel\Core\Autoloader::load('Migrate')
    #9 C:\Users\jmoakley\Dropbox\MoakDesigns\fuel\core\tasks\migrate.php(206): spl_autoload_call('Migrate')
    #10 C:\Users\jmoakley\Dropbox\MoakDesigns\fuel\core\tasks\migrate.php(151): Fuel\Tasks\Migrate::_run('default', 'app')
    #11 C:\Users\jmoakley\Dropbox\MoakDesigns\fuel\core\base.php(428): Fuel\Tasks\Migrate->__call('run', Array)
    #12 C:\Users\jmoakley\Dropbox\MoakDesigns\fuel\core\base.php(428): Fuel\Tasks\Migrate->run()
    #13 C:\Users\jmoakley\Dropbox\MoakDesigns\fuel\packages\oil\classes\refine.php(106): call_fuel_func_array(Array, Array)
    #14 [internal function]: Oil\Refine::run('migrate', Array)
    #15 C:\Users\jmoakley\Dropbox\MoakDesigns\fuel\packages\oil\classes\command.php(125): call_user_func('Oil\Refine::run', 'migrate', Array)
    #16 C:\Users\jmoakley\Dropbox\MoakDesigns\oil(57): Oil\Command::init(Array)
    #17 {main}

    Previous exception:
    Uncaught exception PDOException: SQLSTATE[HY000] [1045] Access denied for user 'enigmama_MD'@'localhost' (using password: YES)
    Callstack:
    #0 C:\Users\jmoakley\Dropbox\MoakDesigns\fuel\core\classes\database\pdo\connection.php(98): PDO->__construct('mysql:host=loca...', 'enigmama_MD', 'MDdev13', Array)
    #1 C:\Users\jmoakley\Dropbox\MoakDesigns\fuel\core\classes\database\pdo\connection.php(170): Fuel\Core\Database_PDO_Connection->connect()
    #2 C:\Users\jmoakley\Dropbox\MoakDesigns\fuel\core\classes\database\query.php(263): Fuel\Core\Database_PDO_Connection->query(1, 'SELECT * FROM `...', false)
    #3 C:\Users\jmoakley\Dropbox\MoakDesigns\fuel\core\classes\dbutil.php(587): Fuel\Core\Database_Query->execute(NULL)
    #4 C:\Users\jmoakley\Dropbox\MoakDesigns\fuel\core\classes\migrate.php(590): Fuel\Core\DBUtil::table_exists('migration')
    #5 C:\Users\jmoakley\Dropbox\MoakDesigns\fuel\core\classes\migrate.php(74): Fuel\Core\Migrate::table_version_check()
    #6 [internal function]: Fuel\Core\Migrate::_init()
    #7 C:\Users\jmoakley\Dropbox\MoakDesigns\fuel\core\classes\autoloader.php(364): call_user_func('Migrate::_init')
    #8 C:\Users\jmoakley\Dropbox\MoakDesigns\fuel\core\classes\autoloader.php(247): Fuel\Core\Autoloader::init_class('Migrate')
    #9 [internal function]: Fuel\Core\Autoloader::load('Migrate')
    #10 C:\Users\jmoakley\Dropbox\MoakDesigns\fuel\core\tasks\migrate.php(206): spl_autoload_call('Migrate')
    #11 C:\Users\jmoakley\Dropbox\MoakDesigns\fuel\core\tasks\migrate.php(151): Fuel\Tasks\Migrate::_run('default', 'app')
    #12 C:\Users\jmoakley\Dropbox\MoakDesigns\fuel\core\base.php(428): Fuel\Tasks\Migrate->__call('run', Array)
    #13 C:\Users\jmoakley\Dropbox\MoakDesigns\fuel\core\base.php(428): Fuel\Tasks\Migrate->run()
    #14 C:\Users\jmoakley\Dropbox\MoakDesigns\fuel\packages\oil\classes\refine.php(106): call_fuel_func_array(Array, Array)
    #15 [internal function]: Oil\Refine::run('migrate', Array)
    #16 C:\Users\jmoakley\Dropbox\MoakDesigns\fuel\packages\oil\classes\command.php(125): call_user_func('Oil\Refine::run', 'migrate', Array)
    #17 C:\Users\jmoakley\Dropbox\MoakDesigns\oil(57): Oil\Command::init(Array)
    #18 {main}


    I hope this is more helpful in trying to helping me solve this issue. 
  • There is no help for the server command, it just runs PHP's built-in webserver. And it expects a standard Fuel setup, where you have a public folder (which is your docroot), and in it your index.php front controller.

    If you don't have the /public folder, you can use the -d commandline option to specify the path to your docroot, and -r to specify the path to the router script (by default the phpserver.php in the oil package).

    I've made a note that it isn't documented at the moment.


  • As to your exception: are you on MAMP by any chance? Or some other xAMP package?

    Chances are that your webserver and the PHP cli binary use different php.ini files (on a Mac virtually always the case), which means the correct PHP config isn't loaded.

    Assuming that you've not made a typo, since the error message is quite clear: Access denied for user 'enigmama_MD'@'localhost' (using password: YES)
  • I am using XAMPP on Windows 7 and I finally corrected the Access issue, it turns out that I needed to add a Remote Access on my webhost. Weird but it is no longer telling me that message it is now telling me that the connection is taking too long to respond. Another issue that I'll have to research later tonight. 
  • hmm... having fun I see. ;-)

    I've added the missing "oil server" documentation and added inline help for the "server" command to the 1.8/develop branch. It should come online soon, at http://dev-docs.fuelphp.com.
  • Lol, I suppose you could say that. 

    Thank you for the help! :)
  • Start it on the commandline, and use your browser to point to the hostname and port you've specified (by default, http://localhost:8000)

    How do you use your browser to point to the hostname and port for oil server?
  • just type the URL in?
  • I finally got it!! I had to add the server IP address to both db.php in config files. 
  • HarroHarro
    Accepted Answer
    Both?

    In general you only need to use one db.php, which is in your environment folder. The one in app/config is only meant for some global (over all environments) defaults, and should under normal circumstances not be changed.
  • I know that. I wanted all of my changes to be done on my remote server because I move around so much that it is frustrating and annoying that I have to repeat the same process on different computers but since I got it fixed and realized that I only needed to make changes to one so I proceeded to remove the one that I didn't really need to make changes to. 

    I should not have to make anymore changes to the db.php for the rest of my development process so I am very excited to move forward. 

Howdy, Stranger!

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

In this Discussion