0

I have background in programming (I am an electrical engineer and have become familiar with numerous languages over the years); however, I only starting working with wordpress and backend web development in the past few weeks.

I taught myself php/html/css over the past two weekends... built a plug in, made custom page types, etc. Now working on building a theme. But even as I get deeper into how WP and all the other applications come in to play, there is one aspect I can't seem to understand even with all the research I have done.

How exactly does WP work, fundamentally, in conjunction with a web server?

I know WP is a CMS application that essentially is acting as an admin GUI to aid in building websites/storing data without a lot of coding knowledge. I know WP stores/pulls info from a database through MySQL, provides 'core' functions for developers to access that data, etc. I understand the loop and how the static (HTML/CSS) and dynamic(JS) portions of the site are built uses php and the file structure + content. I get the web server processes a page request and pulls the static/dynamic content for the site.

But how is a web server communicating with WP? Does apache only talk to WP or does it communicate with the database/file structure directly? It seems that the database/meta data is stored by WP so at some point apache must have to pull from WP... And to add to my confusion, I host my files with dream host which is also a web server but seems to have some components of apache?

What I am not understanding? Any insight would be greatly appreciated!

1
  • Also thought that maybe apache is just hosting WP content such as the database with meta data/input to widgets/etc... and then dreamhost (in my case) is storing the files/themes/custom page php scripts/etc.??
    – tor
    Nov 6, 2017 at 6:47

2 Answers 2

2

Apache only runs the index.php of WordPress, and serves static files (images, css, js etc). WP does all the rest, including parsing the request to find out what content to show the user. Apache does not (and needs not) know that there is communication with a data base in PHP, and doesn't interact with that database itself at any point.

That's also why you don't necessarily need Apache in the equation, you could also use nginx or other webservers (as long as they offer a way to run php), or no external webserver at all and just use php's internal webserver (though that's mostly for development, idk how well this holds up in production).

8
  • Okay that makes sense! So then what is the purpose of having dream host? From my understanding, if I didn't have a custom theme I wouldn't technically need dream host? Because wordpress houses the database and core files, correct? And I think dream host supports apache which is why I use that one, but it looks like the have the capability to use other servers as well... Thanks so much for your help!
    – tor
    Nov 10, 2017 at 2:14
  • And I see that you said I could use php's internal server too. But I would probably stick to a commercial webserver (dream host) just because I am new to this currently.
    – tor
    Nov 10, 2017 at 2:16
  • You also need MySQL. You can self host WordPress sites, any many do. It's mostly about whether you want to spend the hours or just pay somebody else to do it for you (which is usually cheaper, because they don't do it just for you). Unless you want to learn the tech or have very specific needs, the big players don't address, I'd stay with dreamhost or similar - saves you time and is usually pretty secure.
    – janh
    Nov 10, 2017 at 7:43
  • Okay I think I am almost there to fully understanding this! So I have dreamhost which hosts wordpress and has MySQL. One last thing I am confused on is what server is actually running the wordpress software? Does the hosting service (dreamhost) run Wordpress or does the web sever (apache) run wordpress? What exactly is the hosting service (dreamhost in my case) outputting - Is it just giving the webserver the index.php/single.php/etc. which is then executed on apache or does Dreamhost execute the php scripts and return the html?
    – tor
    Nov 10, 2017 at 8:50
  • Thank you for your patience and taking the time to explain this to me!
    – tor
    Nov 10, 2017 at 8:54
0

I liked the Question but it seems to me Tor is confusing between Site hosting and a CMS (content Management System)?!

  1. Dreamhost is a "WebSite hosting company" that provides Servers (VMs) to Web enabled applications like CMS and others Joomla, etc. (May be they only support WP?)
  2. Wordpress (WP) is a Web enabled multi-tier Client-Server application that consists of 3 Main independent Components working together to implement a CMS. The 3 Components are: 2.1 a Webserver (Apache, ...) that supports http/https Protocols. Gets users requests and pass them on to WP. 2.2 WP is an PHP app that executes PhP Code to resolve User Requests. WP runs Php to interact with MySQL. 2.3 MySQL is an RDBMS where 1 of the Databases owned by WP Application is stored and contains WP Site Content used to resolve Site Users' requests. That's my understanding of this enchilada!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.