What does PHP do for a website?

What does PHP do for a website?

Welcome to the forums, @crashedbeats.

That’s a pretty vague question. Can you explain more clearly what you want to know?

Connect to database, create dynamic pages, run external programs.


Normally, when a page is created entirely out of HTML and CSS and is fetched from the server, it goes straight to the browser to be read. The browser knows how to read HTML and CSS already. We call this client-side scripting.

But when you use PHP in addition to HTML and CSS and that page is called, then the server first reads the PHP code, does what it commands, converts the result into HTML, then sends it to the browser. We call this server-side scripting. The browser doesn’t read PHP code; the PHP is for the server, not the browser.

So if I have a PHP script that tells the server to pull certain rows from a database, then the server will pull the information requested, format it as HTML, then send it to the browser.

1 Like

Also Cron Jobs which can implement tasks from one minute, hourly, daily, weekly, monthly or once every year.

I use daily to download a XML spreadsheet, convert it to a CSV file then update a database of books. Over 22,000 books takes about half a minute to update.

IOT (Internet of Things) can be interfaced to hardware monitoring devices for irrigation crop control, temperature and humidity, car parking availability, etc

Can you clarify your answer as to what PHP does for a website? Are you saying you write cron jobs in PHP and it does something to a website?

A local bookshop uploads a XLS spreadsheet to their website of all the books they have on sale. The spreadsheet is available to download and used in a spreadsheet reader.

I wrote a Cron job to check for updates every hour and download the latest copy. PHP is used to convert the XML spreadsheet into a CSV (comma separated variable) file which can then be checked against the existing database books table. The web site uses Ajax to dynamically search for books, by title, author, etc, similar to typing a request into a browser.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.