About Tobias

Tobias is the founder of incratec.com, a Swiss-based online company.

Please specify the install prefix of iconv with –with-iconv

Error message

configure: error: Please specify the install prefix of iconv with --with-iconv=

Related to

MAMP compilation of PHP extensions as e.g. pnctl or mongo as described e.g. at http://adam.merrifield.ca/2014/09/21/php-mongodb-and-mamp/ or http://linhmtran168.github.io/blog/2013/12/10/setup-boris-with-mamp-in-mac-osx-mavericks/

Solution

run configure without iconv support:

./configure --without-iconv

phpOpenEMM now on github

We recently moved the source code for the PHP – wrapper for the email marketing software OpenEMM to github. It is also available via packagist for easier installation. Feel free to follow, fork and send pull requests!

Links

Symfony2: InactiveScopeException and request

Error message: You cannot create a service (“request”) of an inactive scope (“request”).

[Symfony\Component\DependencyInjection\Exception\InactiveScopeException]   
You cannot create a service ("request") of an inactive scope ("request").

This message is written, when you’re invoking a command on the command line, e.g.

php app/console assetic:dump

Reason: you are using a request object, but this is not available on the command line / cli

The error was in my case that I used an object in my service configuration that references the request object (MobileDetectBundle).

Solution: remove reference for command line

Step 1 was to use a setter for the reference

Step 2 was to create a special compiler pass in the bundle configuration

Source code (based on https://github.com/suncat2000/MobileDetectBundle/commit/73e78070ca7340c9774c19dde3c8460435b0e284 – thanks suncat2000!)

<?php

namespace Acm\DemoBundle\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;

/**
 * CLI listener
 */
class CLIListenerPass implements CompilerPassInterface
{
    /**
     * If CLI, when remove setMobileDetector method from definition mobile_detect.twig.extension
     * @param ContainerBuilder $container 
     */
    public function process(ContainerBuilder $container)
    {
        if (php_sapi_name() == "cli") {
            $definition = $container->getDefinition('acme_demo.extension.my_service');
            $definition->removeMethodCall('setMobileDetector');
        }
    }
}