The Blog


Ubuntu 22.04 LTS + Plesk 18 + PHP 8.1 + Symfony 6.1 and so on

Posted on

First issue after installing all of that was symfony-cli could not find Plesk’s PHP, this fixed it.

sudo ln -s /opt/plesk/php/8.0/bin/php /usr/local/bin/php

Next issue was “KnpMenuBundle” in 6.1 it needs to be used as a service, see here. Also if you want custom template the path needs to be set this way; if your template is in “templates/Menu/knp_menu.html.twig”


    # use 'twig: false' to disable the Twig extension and the TwigRenderer
        template: Menu/knp_menu.html.twig
    #  if true, enables the helper for PHP templates
    templating: false
    # the renderer to use, list is also available by default
    default_renderer: twig

Another issue was, how to use raw SQL in symfony 6, very simple thanks to auto-wiring.

Few samples of raw SQL for MySQL:

# get connection
$conn = $managerRegistry->getConnection();

# sample 1
$sql = "SELECT * FROM somethingWHERE id = :user_id";
$resultSet = $conn->executeQuery($sql, ['user_id' => 123]);
$results = $resultSet->fetchAllAssociative();

# sample 2
$sql = "SELECT * FROM something";
$result = $conn->fetchAllAssociative($sql);
Posted in Symfony 6, Uncategorized Leave a comment

Symfony 3 adding “swiftmailer-mailgun-bundle” on PLESK

Posted on

Just 4 bundles to make this work

/opt/plesk/php/7.3/bin/php -d memory_limit=-1 /usr/lib/plesk-9.0/composer.phar require nyholm/psr7
/opt/plesk/php/7.3/bin/php -d memory_limit=-1 /usr/lib/plesk-9.0/composer.phar require kriswallsmith/buzz
/opt/plesk/php/7.3/bin/php -d memory_limit=-1 /usr/lib/plesk-9.0/composer.phar require cspoo/swiftmailer-mailgun-bundle
/opt/plesk/php/7.3/bin/php -d memory_limit=-1 /usr/lib/plesk-9.0/composer.phar require mailgun/mailgun-php


Symfony 3.4

Also add to your AppKernel:

new cspoo\Swiftmailer\MailgunBundle\cspooSwiftmailerMailgunBundle(),

Configure your application with the credentials you find on the domain overview on the dashboard.

// app/config/config.yml:
    key: "key-xxxxxxxxxx"
    domain: ""
    endpoint: "" # Optional. Use this config for EU region. Defaults to ""
    http_client: "httplug.client" # Optional. Defaults to null and uses discovery to find client. 

# Swiftmailer Configuration
    transport: "mailgun"
    spool:     { type: memory } # This will start sending emails on kernel.terminate event

Note that the swiftmailer configuration is the same as the standard one – you just change the mailer_transport parameter.

Posted in Symfony3 Leave a comment

Adding to php7.x in PLESK

Posted on

First install DEV for the PHP you are using. In my case that would be PLESK PHP 7.1

apt-get install make gcc plesk-php71-dev

Next use PECL to install dbase extension.

/opt/plesk/php/7.1/bin/pecl install dbase-7.0.0beta1

If all goes good, you should see this:

Build process completed successfully
Installing '/opt/plesk/php/7.1/lib/php/modules/'
install ok: channel://
configuration option "php_ini" is not set to php.ini location
You should add "" to php.ini

Last step is to register the extension:

echo "" > /opt/plesk/php/7.1/etc/php.d/dbase.ini

plesk bin php_handler --reread

Posted in PHP, PLESK 2 Comments
Next Page »