If you like DNray Forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...

 

Novice PHP developer

Started by lovish, Jan 24, 2023, 03:31 AM

Previous topic - Next topic

lovishTopic starter

Hello to all forum users! I've been teaching web technologies in a scattered manner for about a year now. Since I work as a site administrator in a company, I need to have knowledge on various topics. However, what I really want is to become a professional and learn the most important things in a logical order. Although there are many resources online, I often find that they lack clear explanations.

For instance, how does the browser actually find out the IP address of the server? Why does Apache handle our request instead of other possible options? And why does Apache launch PHP for processing index.php? Furthermore, how does PHP exactly handle the script index.php?

The first question seems quite straightforward. We simply enter the domain name and ask the DNS server to provide the corresponding IP address. However, the other questions are not as clear-cut. For example, Apache handles our request because I want it to, but is there more to it?

I would really appreciate it if someone could take the time to explain these concepts in detail. Thank you in advance!
  •  


amomswish

At first, the IP address associated with a domain is requested from the hosts file on your computer. If it's not found there, your computer will send a request to DNS for the corresponding IP address.

When you install Apache on your local server, it generates all your directories from the home folder (including the domain name) in the hosts file. These directories are then forwarded to the local IP of the server (127.0.0.1), which has its own dedicated IP address.

Since ".php" files require a PHP interpreter to function properly, they are referred to as server scripts and cannot work by themselves.

By default, the server looks for files named index(.php/.html/...) and opens them as the main page with priority given to .php files. This is the path used to access requested URL pages.

As a side note, understanding how servers and domains work can be quite complex. It's important to keep learning and expanding your knowledge in this field.
  •  

jonathanross

To become proficient in web technologies, it's essential to understand the fundamentals of networks and how protocols work. Additionally, it's important to know why DNS is necessary.

In terms of practical skills, it's useful to have knowledge of .htaccess and its uses. You should also be familiar with using local servers like Denver.

When it comes to CMS, it's recommended to start with popular systems like WordPress and MODx. As for programming languages, you should focus on PHP, JavaScript + jQuery, HTML, CSS, and MySQL. These five must-know topics will set a solid foundation for your career in web development. Learning these skills will ensure you never run out of work opportunities.

Keep in mind that web technologies are constantly evolving, so it's important to stay up-to-date with current trends and technologies.
  •  

Optimitron

It's important to understand the basics of design, even if you're a backend developer. A well-designed site ensures that users can easily navigate and understand your work. If you don't want to focus on design, you can always look for ready-made solutions similar to your project.

Use keyboard shortcuts and Emmet to increase your development speed. As a developer, it's vital to use keyboard shortcuts instead of relying on the mouse. Familiarize yourself with the Emmet plugin and keyboard shortcuts in your code editor.

Frameworks like Bootstrap or Bulma can significantly improve the quality of your work. It's also essential to make sure your sites are mobile-friendly, especially since mobile versions are becoming increasingly important. Flex or Grid technologies can help ensure adaptability.

Don't leave your projects incomplete! Finish your projects as thoroughly as possible by adding features and modern technologies like authorization and mobile versions. Employers want to see voluminous, high-quality projects that showcase your skills.

Finally, publish your finished projects online using GitHub pages, Heroku, or other inexpensive hosting options. This will allow others to view and evaluate your work, and could potentially lead to new opportunities in the future. Keep in mind that continuous learning and staying up-to-date with new developments in web technologies is key to a successful career as a developer.
  •  

satyampandey

When a browser needs to communicate with a server, it starts by converting the human-readable domain name into an IP address. This is done through the Domain Name System, or DNS. When you enter a domain into your browser, the following happens:

1. DNS Resolution: Your browser first checks its local cache to see if it already knows the IP address for that domain. If not, it sends a request to a DNS server. This server queries others until it finds the authoritative server for that domain. Once it obtains the IP address, the browser can send an HTTP request to it.

Now that the browser knows where to send the request, let's discuss how the server processes it. When you type in a URL pointing to a web application, your HTTP request arrives at a web server. Apache is one of the most widely used web servers, but similar processes occur with others, like Nginx.

2. Request Handling by Apache: When the server receives the request, it checks configuration files (such as httpd.conf) to determine how to handle it. Apache listens on specific ports (usually port 80 for HTTP and 443 for HTTPS) and maps incoming requests to resources on the server. If you've configured your server to use Apache, it will manage requests for that domain.

3. Processing PHP with Apache: If the request is for a PHP file like index.php, Apache needs guidance on what to do with it. This is where modules come into play. When Apache is set up, it often utilizes a module called mod_php, which allows it to interpret and execute PHP scripts. When a request for index.php comes in, Apache recognizes the file type through its configuration and passes it to the PHP interpreter.

4. How PHP Executes the Script: Once PHP receives the index.php file, it reads the code within it. PHP executes the instructions written in the script, which may involve database queries and generating HTML. The output of this execution is typically HTML, which is sent back to Apache. In turn, Apache takes this output and sends it back to the client's browser as an HTTP response.

Each step in this process involves configurations you can control based on your needs as a web administrator. The entire setup revolves around server-client communication, with defined roles for each component in the technology stack.
The browser finds the server's IP address using DNS, the server (like Apache) is configured to route requests, it uses appropriate modules for different file types like PHP, and PHP executes scripts to produce dynamic content. Understanding how these components interact will significantly enhance your ability to troubleshoot and develop web applications in a more structured manner.
  •  


If you like DNray forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...