I tried to look at pas2php, but all I could find is a collection of units, but no compilable project.
Anyway => ignoring the extension ".cgi", is the file executable? Can you call/execute it from the command line?
If so, set:
- debug info to "dwarf + set"
- optimization to -O- (or -O1)
- disable anything that says "strip"
The exe should be of a reasonable big size.
For testing, you should be able to make a copy of the exe, and run "strip copy_of_exe"
This should reduce the filesize by more than half.
Check your debugger setup:
https://wiki.lazarus.freepascal.org/Debugger_Setup