skip to Main Content

new job new requirement, my boss have just a symfony production version, my task was, upload this app, change the routing manually and database, like cloning all app, cleaning the cash and put it to new cpanel new client, i have done it but when it was on the same server different cpanel, it works, now while uploading the code with the same steps to other hosting service, nothing works, the web folder to launch the app does not give the permission

i checked htaccess files and any other parameter i know,

i noticed this on app_dev

// This check prevents access to debug front controllers that are deployed by accident to production servers.
// Feel free to remove this, extend it, or make something more sophisticated.
if (isset($_SERVER['HTTP_CLIENT_IP'])
    || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
    || !(in_array(@$_SERVER['REMOTE_ADDR'], array('41.251.179.80','127.0.0.1', 'fe80::1', '::1')) || php_sapi_name() === 'cli-server')
) {
    header('HTTP/1.0 403 Forbidden');
    exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}

event removing this lines didn’t work

how symfony security works and how can i solve this

2

Answers


  1. Chosen as BEST ANSWER

    i have used the echo "alert('1');"; to show where exactly it stops on the main file, and the line was $response = $kernel->handle($request);

    <?php
        
        use SymfonyComponentClassLoaderApcClassLoader;
        use SymfonyComponentHttpFoundationRequest;
        
        $loader = require_once __DIR__.'/../app/bootstrap.php.cache';
        
        // Enable APC for autoloading to improve performance.
        // You should change the ApcClassLoader first argument to a unique prefix
        // in order to prevent cache key conflicts with other applications
        // also using APC.
        /*
        $apcLoader = new ApcClassLoader(sha1(__FILE__), $loader);
        $loader->unregister();
        $apcLoader->register(true);
        */
        
        require_once __DIR__.'/../app/AppKernel.php';
        //require_once __DIR__.'/../app/AppCache.php';
        
        $kernel = new AppKernel('prod', true);
        
        $kernel->loadClassCache();
        //$kernel = new AppCache($kernel);
        
        // When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter
        //Request::enableHttpMethodParameterOverride();
        $request = Request::createFromGlobals();
        $response = $kernel->handle($request);
        $response->send();
        $kernel->terminate($request, $response);
    

  2. if you are moving it to a new server you most likely need to install your composer dependencies. Do a composer install to bring in all the supported items for your environment.

    The app_dev.php is used in Symfony 3 and is what allows you to access the "dev" version of the site that would also include the Symfony toolbar if it is installed.

    Check your var/logs directory for clues and you will most likely need to clear the Symfony cache.

    Also, on your new server you need to point your apache document root to the public or www folder inside the Symfony project. Depending on your setup will vary as this can be a custom folder.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search