Divide your search into three parts. The first part is the interface of the future web search engine, which is written in PHP. The second part is the index database (My SQL) that stores all the information about the pages. The third part is a web crawler which will index web pages and put their data in the index, it is made in Delphi language.
Let's start to create the interface. Create a file index.php. To do this, divide the page into two parts using the table. The first part is a search form, the second – search results. In the upper part create a form that will send information to the file index.php with the get method. It will be located three elements – a text box and two buttons. One button is used to submit the query, the second is to clean the field (this button is not required).
Give the text field the name "search", the first button (the one that sends a request) the name "Search". The name of the form itself, leave as it is – "form1".
The results are displayed in the bottom of the table with php, so open tag <?php and start writing code.
Connect configuration file to connect to the database.

include "config.php";

Check whether you have pressed the button "Search".

if (isset($_GET['button'])) {code to be executed in the case if the button "Search" is pressed} else {code to be executed in the case if the button "Search" is not pressed}

If the button is pressed, then check for a search query.

if (isset($_GET['search'])){$search=$_GET['search'];}
If the search query is, then set the variable $search text to search for.
Check the query that it was not empty and was not shorter than three symbols.
if ($search!=" && strlen($search)>2){ code to search the database } else {echo "you Specified an empty search query or search string contains less than 3 characters.";}

In that case, if the search query will satisfy the upper condition, start the search script.
Start a loop that will display the search results using printf.
That's about it. If you have the necessary knowledge, then you may want to add in the search the items you want and make your algorithm of its creation.