In a full-page advertisement in several newspapers, including Lebanon's leading An-Nahar and Jordan's Al-Rai, the government said "the strongest possible action is taken" against people who attempt to enter Hungary illegally.
"Do not listen to the people smugglers. Hungary will not allow illegal immigrants to cross its territory," the advertisement reads in English and Arabic.
Lebanon has nearly 1.2 million Syrian refugees and Jordan about 630,000, some of whom have expressed interest in migrating to Europe because of dwindling aid and work opportunities.
Hungary, which closed its border with Serbia on Sept. 15, erected another steel barrier at the Beremend border crossing with Croatia to try to slow the flow of migrants.
But they kept coming. People fleeing violence and poverty in the Middle East, Asia and Africa are crossing the Mediterranean Sea in rickety smuggler boats and rushing from one European border to the next to try to reach welcoming countries such as Germany and Sweden.
Earlier this month, Denmark's Ministry of Immigration, Integration and Housing posted advertisements in Lebanese newspapers aiming to deter migrants, saying that the Scandinavian nation has reduced social aid to migrants by 50 percent recently.
Denmark also warned that migrants whose applications are rejected will be deported immediately.
Syria's civil war, now in its fifth year, has killed more than 250,000 people and generated more than 4 million refugees.