Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
php oil refine robots
  • Hello,

    I want to create a task.
    In order to implement, I would like to run "php oil refine robots".

    But I have this error : "Fatal error: Cannot redeclare class Fuel\Core\Autoloader"

    What's the matter ?
  • Deleting the two lines : 
    require COREPATH.'classes'.DIRECTORY_SEPARATOR.'autoloader.php';
    class_alias('Fuel\\Core\\Autoloader', 'Autoloader');

    I have another error :
    Notice - Undefined index: HTTP_HOST in APPPATH/config/config.php on line 26

    I try to do this : "FUEL_ENV=mysite_development php oil refine robots", but it fail in : 

    "'FUEL_ENV' is not recognized as an internal or external command, operable program or batch file."
  • HarroHarro
    Accepted Answer
    If looks like you have a version issue somewhere.

    Have you (recently) updated the core, but not the index.php and the oil script? Of forgot to run composer to update?
  • I upgraded the core et index.php and the oil script. It looks better ... but there is a but : 

    It works when I run on my staging server : 
    env FUEL_ENV=staging php oil r robots run
    but not when I run on my development server (wamp) : 
    set FUEL_ENV=development && php oil r robots run

    It fails in "Error - invalid data source name in C:/wamp/www/myproject/fuel/core/classes/database/pdo/connection.php on line 112".

    Debugging, it looks like the db config is not found. 

    It work when I paste my development db config file in the core db config file : fuel/core/config/db.php

    I don't understand why the set FUEL_ENV doesn't work ... Could you help me please ?

    For information, I set Environment with server environment variables with Apache - Server Configuration
  • The development environment is default, so passing that or not should not be any difference.

    If you do this:

        set FUEL_ENV=production && php oil -v

    what does Fuel say the environment is?
  • If it displays the wrong environment, can you do:

        set FUEL_ENV=something && php -a

    and then on the PHP interactive prompt, dump $_ENV and $_SERVER ?

    We've noticed that depending on the PHP version and the way is called, sometimes the environment variable ends up in $_SERVER instead of $_ENV. This has been addressed recently in 1.8/develop.
  • When I do 

    set FUEL_ENV=production && php oil -v

    it returns : 

    Error - invalid data source name in C:/wamp/www/site/fuel/core/classes/database/pdo/connection.php on line 112

    I'm working whith wamp, and php -a doesn't seems to work. So I used a file : 

    set FUEL_ENV=coc_staging && php testphp.php


    It returns : 
    // $_ENV
    array(0) {
    }
  • and for $_SERVER : 
    // $_SERVER
    array(67) {
      ["ALLUSERSPROFILE"]=>string(14) "C:\ProgramData"
      ["APPDATA"]=>string(29) "C:\Users\remi\AppData\Roaming"
      ["COMMONPROGRAMFILES"]=>string(29) "C:\Program Files\Common Files"
      ["COMPUTERNAME"]=>string(4) "WS09"
      ["COMSPEC"]=>string(27) "C:\windows\system32\cmd.exe"
      ["CommonProgramFiles(x86)"]=>string(35) "C:\Program Files (x86)\Common Files"
      ["CommonProgramW6432"]=>string(29) "C:\Program Files\Common Files"
      ["EXECIGNORE"]=>string(5) "*.dll"
      ["FP_NO_HOST_CHECK"]=>string(2) "NO"
      ["HOME"]=>string(21) "C:\cygwin64\home\Remi"
      ["HOMEDRIVE"]=>string(2) "C:"
      ["HOMEPATH"]=>string(11) "\Users\remi"
      ["HOSTNAME"]=>string(4) "WS09"
      ["INFOPATH"]=>string(41) "/usr/local/info:/usr/share/info:/usr/info"
      ["LANG"]=>string(11) "en_GB.UTF-8"
      ["LOCALAPPDATA"]=>string(27) "C:\Users\remi\AppData\Local"
      ["LOGONSERVER"]=>string(8) "\\SRVSBS"
      ["NUMBER_OF_PROCESSORS"]=>string(1) "8"
      ["OLDPWD"]=>string(16) "/cygdrive/c/wamp"
      ["OPENSSL_CONF"]=>string(32) "C:\OpenSSL-Win64\bin\openssl.cfg"
      ["ORIGINAL_PATH"]=>string(772) "/cygdrive/c/Program Files (x86)/Intel/iCLS Client:/cygdrive/c/Program Files/Intel/iCLS Client:/cygdrive/c/windows/system32:/cygdrive/c/windows:/cygdrive/c/windows/System32/Wbem:/cygdrive/c/windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files/Intel/Intel(R) Management Engine Components/DAL:/cygdrive/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL:/cygdrive/c/Program Files/Intel/Intel(R) Management Engine Components/IPT:/cygdrive/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/IPT:/cygdrive/c/Program Files/TortoiseSVN/bin:/cygdrive/c/Program Files (x86)/nodejs:/cygdrive/c/wamp/bin/php/php5.6.16:/cygdrive/c/ProgramData/ComposerSetup/bin:/cygdrive/c/Users/remi/AppData/Roaming/npm:/cygdrive/c/wamp/bin/php/php5.5.12"
      ["OS"]=>string(10) "Windows_NT"
      ["OnlineServices"]=>string(15) "Online Services"
      ["PATH"]=>string(693) "C:\cygwin64\usr\local\bin;C:\cygwin64\bin;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\nodejs;C:\wamp\bin\php\php5.6.16;C:\ProgramData\ComposerSetup\bin;C:\Users\remi\AppData\Roaming\npm;C:\wamp\bin\php\php5.5.12;C:\cygwin64\lib\lapack"
      ["PATHEXT"]=>string(53) ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC"
      ["PRINTER"]=>string(26) "\\SRVSBS\Brother_HL-7050-1"
  •   ["PROCESSOR_ARCHITECTURE"]=>string(5) "AMD64"
      ["PROCESSOR_IDENTIFIER"]=>string(50) "Intel64 Family 6 Model 60 Stepping 3, GenuineIntel"
      ["PROCESSOR_LEVEL"]=>string(1) "6"
      ["PROCESSOR_REVISION"]=>string(4) "3c03"
      ["PROFILEREAD"]=>string(4) "true"
      ["PROGRAMFILES"]=>string(16) "C:\Program Files"
      ["PS1"]=>string(57) "\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ "
      ["PSModulePath"]=>string(51) "C:\windows\system32\WindowsPowerShell\v1.0\Modules\"
      ["PTSMINSTALLPATH_X86"]=>string(72) "c:\Program Files (x86)\Hewlett-Packard\HP ProtectTools Security Manager\"
      ["PUBLIC"]=>string(15) "C:\Users\Public"
      ["PWD"]=>string(20) "/cygdrive/c/wamp/www"
      ["Platform"]=>string(3) "BPC"
      ["ProgramData"]=>string(14) "C:\ProgramData"
      ["ProgramFiles(x86)"]=>string(22) "C:\Program Files (x86)"
      ["ProgramW6432"]=>string(16) "C:\Program Files"
      ["SESSIONNAME"]=>string(7) "Console"
      ["SHELL"]=>string(9) "/bin/bash"
      ["SHLVL"]=>string(1) "1"
      ["SYSTEMDRIVE"]=>string(2) "C:"
      ["SYSTEMROOT"]=>string(10) "C:\windows"
      ["TEMP"]=>string(15) "C:\cygwin64\tmp"
      ["TERM"]=>string(5) "xterm"
      ["TMP"]=>string(15) "C:\cygwin64\tmp"
      ["TZ"]=>string(13) "Europe/Zurich"
      ["USER"]=>string(4) "Remi"
      ["USERDNSDOMAIN"]=>string(16) "FAREXCO-SA.LOCAL"
      ["USERDOMAIN"]=>string(10) "FAREXCO-SA"
      ["USERDOMAIN_ROAMINGPROFILE"]=>string(10) "FAREXCO-SA"
      ["USERNAME"]=>string(4) "Remi"
      ["USERPROFILE"]=>string(13) "C:\Users\remi"
      ["WINDIR"]=>string(10) "C:\windows"
      ["_"]=>string(38) "/cygdrive/c/wamp/bin/php/php5.6.16/php"
      ["PHP_SELF"]=>string(11) "testphp.php"
      ["SCRIPT_NAME"]=>string(11) "testphp.php"
      ["SCRIPT_FILENAME"]=>string(11) "testphp.php"
      ["PATH_TRANSLATED"]=>string(11) "testphp.php"
      ["DOCUMENT_ROOT"]=>string(0) ""
      ["REQUEST_TIME_FLOAT"]=>float(1459758279.9113)
      ["REQUEST_TIME"]=>int(1459758279)
      ["argv"]=>array(1) {[0]=>string(11) "testphp.php"}
      ["argc"]=>int(1)
    }
  • So no environment variable is set (or passed) at all?

    For WAMP you can also add it to your .htaccess:

       setEnv FUEL_ENV production

    In the default .htaccess delivered when you installed the framework there is already a commented out example.

    I don't have Windows available at the moment, so I can't easily test alternatives.
  • Can you also check your php.ini? If it doesn't contain:

        variables_order = "EGPCS"

    or it is missing the "E", then the environment isn't populated. And the last possible issue that depending on PHP version, PHP type, and OS, an environment variable can end up in either $_ENV of $_SERVER (this doesn't seem to be your problem though). This issue will be addressed in 1.8.
  • With cygwin, it works ! 

    Ther is no error with : 
    "env FUEL_ENV=coc_staging php oil r robots"

    I'm sorry, I don't know if I update something else.

    For informations : 
    In my php.ini, I have "variables_order = "GPCS""

    In my .htaccess, I comment "set fuelphp environement" and set the FUEL_ENV in the vhosts


  • It should also work from the commandline with the E added to the variable order.

    I'll try to setup a Windows VM later to verify this, and update the docs if needed (unless you can verify this for me).

Howdy, Stranger!

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

In this Discussion