This paper develops a discrete constrained controller for electrohydraulic system (EHS) controlled by proportional directional control (PDC) valve while taking parametric uncertainties into account. The proposed controller solves the discrete barrier Lyapunov function via convex optimization while taking into consideration the system constraints such as state and actuator constraints. The proposed control law successfully tracks the reference trajectory while satisfying the state and actuator constraints. It is proven that the tracking error always converges to an arbitrary small neighborhood which is validated using Lyapunov stability analysis. The effectiveness of the proposed discrete barrier Lyapunov function based constrained controller was verified in a simulation environment and also through experimentation. From the simulation and experimental results, it is clear that the proposed controller drives the load to accurately track the reference trajectory in the presence of uncertainty and unknown disturbances.