Remove the bricks that are leaning or sinking, using a flat iron bar to minimize damage. If the bricks are in a good enough condition to be re-used, number them as you remove them by writing with a marker or piece of chalk. This will make it possible for you to reinstall them in the same position in which they were originally laid, ensuring that they fit the space available.
Check the porch cavity for water entry points, which may saturate the soil in the cavity and cause it to settle or sink. With a shovel, remove any soil that has a clay-like consistency, as this does not weather well enough to use as infill. Also, remove any infill that places pressure against a damaged area of the sidewall.
Rebuild the sections of sidewall that you have removed, using mortar and the displaced bricks in their original positions if possible. Wait for the mortar to dry completely, then shore up the walls with sheets of plywood supported by heavy rocks. This will prevent the new walls from moving again under the stress of compacting the infill.
Level the infill in the porch cavity. Fill any large gaps with rocks; pour in quantities of crushed stone or coarse pea gravel until all spaces between the rocks and other debris are filled and covered. Compact the infill using a hand tamper or pressure roller, going over the area several times until you can walk securely on a sheet of plywood laid across the surface.
Cover the top of the infill with a sheet of builder’s plastic, which helps to reduce the amount of water getting in. Lay a solid slab of concrete as a surface, which will be more durable and weatherproof and is less likely to degenerate over time. If you prefer a brick porch floor, spread a thin layer of mortar on the concrete slab once it cures, lay the bricks in the mortar and brush loose cement powder in between the cracks with a broom, followed by a light watering to help the cement harden.