P4WEB_PORT and P4FTP_PORT are not optional variables and will cause mkdirs.sh to report an "unbound variable" when trying to setup the instance vars file.
In mkdirs.sh around line 576 there is a check to "Silently ignore if optional settings aren't set", which includes the P4WEB_PORT and P4FTP_PORT values. However, around line 1304 those values are used by sed and if they aren't set then multiple problems arise:
1. The script will die with "./mkdirs.sh: line 1297: P4WEB_PORT: unbound variable" and report an exit code of 0.
2. The "Failed to generate p4_${SDPInstance}.vars" error message is not reported to the user.
3. The p4_instance.vars file is not created.
The fix / workaround is just to set them in the mkdirs.cfg file even if they aren't needed / used by the instance.