Changing permalink structure breaks link to .php file which generates files dynamically

I was bootstrapping WordPress in ics.php by including wp-blog-header.php (which usually works for me), but after changing it to include wp-load.php instead, the files generated were no longer not being found.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)