A man said to him, "Will you not go out to fight?"He replied, "I heard the Messenger of Allah ﷺ say, 'Islam is built upon five: the testimony that there is no god but Allah, establishing the prayer, giving the zakat, performing the pilgrimage, and fasting Ramadan.'"
أخبرنا محمد بن عبد الله بن عمار قال حدثنا المعافى يعني ابن عمران عن حنظلة بن أبي سفيان عن عكرمة بن خالد
أن رجلا قال له ألا تغزو قال سمعت رسول الله ﷺ يقول بني الإسلام على خمس شهادة أن لا إله إلا الله وإقام الصلاة وإيتاء الزكاة والحج وصيام رمضان
Bukhari narrated it in the Book of Faith, chapter, "Your supplication is your faith," based on the words of the Most High, "Say, what would my Lord do with you if not for your supplication?" [Furqan 25:77], no. 8, and Muslim narrated it in the Book of Faith, chapter explaining the pillars of Islam and its great foundations, no. 16/22, from the hadith of Hanzala, with the same wording.