People often think of duplicate content as content copied over from another website. While in fact it refers to duplicate pages on the same site.
While Google strongly advise to not have multiple pages with the same content, there's situations where you simply have to have them and there's a justified use for that.
https://developers.google.com/search...uplicate-pages
So if you have the same content on multiple pages, just pick one url and point canonicals to it. Or as TheLegacy above said, you can add noindex to them if they are less important.
If you have links pointed to domain.com/directory/index.php?page=2 and it has to get ranked on Google, I would set canonicals as domain.com/directory/ so that url will get all the link juice.
If you want to make your urls search engine friendly a general advice is to avoid using index.php in the urls since it's redundant (index.php or index.html is usually a default file for serving a directory), so use only /directory/ instead and you are good to go. If you need pagination, your url domain.com/directory/index.php?page=2 could get http rewritten as domain.com/directory/2/ in .htaccess (or nginx rewrites).