dracoblue.net

Make symfony dotenv use putenv

The other day a friend of mine was using google-auth-library-php in combination with google-cloud-php-pubsub and wanted to set the path for the google credentials file via GOOGLE_APPLICATION_CREDENTIALS in .env.

So we figured that this did not work anymore in the newer version of dotenv (see commit in 4.3) the default value for use_putenv changed to false. And in symfony 5 there was a breaking change to switch use_putenv from true to false (see the putenv deprecation pull request.

Continue reading ...

In dotenv, gcloud, php, symfony by DracoBlue @ 16 Jan 2023 | 236 Words

Compiling newrelic php agent on mac m1 arm64

According to the arm64 newrelic php page there is arm64 support for the php agent, if it is running Amazon Linux or CentOS Linux8, but not for Apple or M1.

However, when I pulled the latest tar.gz (v10.4.0.316 as of 2023/01/13) at https://github.com/newrelic/newrelic-php-agent/archive/refs/tags/v10.4.0.316.tar.gz and tried to compile - it did nearly work.

The first tries of make agent, will fail with missing pcre_compile or aclocal or glibtoolize. This can be fixed by installing brew install pcre for pcre_compile, brew install automake for aclocal and brew install libtool for glibtoolize.

Then finally running make agent ends up in:

util_hash.c:198:5: error: unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
    case 2:
    ^
util_hash.c:198:5: note: insert '__attribute__((fallthrough));' to silence this warning
    case 2:
    ^
    __attribute__((fallthrough));
util_hash.c:198:5: note: insert 'break;' to avoid fall-through
    case 2:
    ^
    break;
Continue reading ...

In apple, arm, homebrew, newrelic, php by DracoBlue @ 14 Jan 2023 | 655 Words

Not working precedence of real environment variables in symfony dotenv

When configuring symfony with .env and real environment variables I ran into an interesting issue.

My first test drive of nginx unit (which is nice to not have a php-fpm+nginx docker container, but just one) I setup the php box and noticed that even though the Overriding Section states different, it seemed like my real environment variables did not have precedence in this case.

Continue reading ...

In nginx unit, php, symfony by DracoBlue @ 13 Sep 2022 | 198 Words

Unix socket in Doctrine DSN

When using the cloud sql proxy especially with cloud run for cloudsql mysql instance connections, these are available as unix sockets like this:

/cloudsql/PROJECT_NAME:REGION_NAME:INSTANCE_NAME

The gcloud documentation says with php pdo (without doctrine) the connection shall be made like this:

$dsn = sprintf(
    'mysql:dbname=%s;unix_socket=%s/%s',
    $dbName,
    $socketDir,
    $connectionName
);

// Connect to the database.
$conn = new PDO($dsn, $username, $password, $conn_config);

But if you set DATABASE_URL for:

doctrine:
    dbal:
        url: '%env(resolve:DATABASE_URL)%'

like this, you will receive:

An exception occurred in the driver: SQLSTATE[HY000] [2002] No such file or directory  
Continue reading ...

In cloudsql, doctrine, gcloud, mysql, php by DracoBlue @ 11 Sep 2022 | 201 Words

Update DNS Wildcard Certificate with acme.sh in Kubernetes

The official gitlab helm chart for pages does not support a cert manager for *.pages.example.org as this is officially not supported. Thus you have to create the wildcard certificate manually like described in the docs.

So how to update this regulary? I think there are multiple options (using a different tool then cert manager, running a cronjob in k8s doing acme.sh or others), but I choose today: a scheduled pipeline in gitlab.

Continue reading ...

In acme-sh, cert-manager, gitlab, kubernetes, terraform by DracoBlue @ 23 Jan 2022 | 1233 Words

Page 1 - Page 2

Give something back

Were my blog posts useful to you? If you want to give back, support one of these charities, too!

Report hate in social media Campact e.V. With our technology and your help, we protect the oceans from plastic waste. Gesellschaft fur Freiheitsrechte e. V. The civil eye in the mediterranean

Recent Dev-Articles

Read recently

Recent Files

About