Lec3

Cards (17)

  • PHP
    Hypertext Preprocessor, a widely used open-source scripting language primarily designed for web development and can be embedded into HTML
  • PHP was created by Danish-Canadian programmer Rasmus Lerdorf
    1994
  • PHP
    • Originally as a set of Common Gateway Interface (CGI) binaries written in C for tracking visits to his online resume
    • Evolved into a full-fledged programming language with a rich set of features and functionalities
  • Installing PHP
    1. Use a package manager like Homebrew for macOS or apt-get for Linux
    2. Download PHP binaries directly from the official PHP website and configure them manually
    3. Use pre-packaged solutions like XAMPP, WAMP, or MAMP that bundle PHP along with other components
  • XAMPP
    Cross-Platform, Apache, MySQL, PHP and Perl
  • Importance of PHP
    • Versatility - can handle various tasks from creating dynamic web pages to building complex web applications
    • Ease of Use - simple and intuitive syntax, accessible to both beginners and experienced developers
    • Large Community and Resources - vast and active community contributing to its ecosystem
    • Compatibility - compatible with different operating systems and web servers
    • Scalability - powers a significant portion of the web, suitable for projects of all sizes
  • Setting Up a Development Environment
    1. Local Development - use solutions like XAMPP, WAMP, or MAMP
    2. Remote Development - ensure server has PHP installed and configured
  • Writing PHP Code
    1. Create PHP Files with .php extension
    2. Embed PHP code directly into HTML files using <?php ?> tags
    3. PHP statements end with a semicolon (;)
    4. Basic Syntax: PHP statements end with a semicolon (;). Variables in PHP start with a dollar sign ($), followed by the variable name.
    5. Comments: Use // for single-line comments and /* */ for multi-line comments.
  • Running PHP Code
    1. Local Testing - save PHP file in appropriate directory and access through web browser
    2. Remote Deployment - upload PHP files to web server using FTP or SSH and access through server's URL
  • FTP
    File Transfer Protocol - computer software that facilitates the secure exchange of files over a TCP/IP
  • TCP/IP
    Transmission Control Protocol/Internet Protocol - a communications standard that enables application programs and devices to exchange messages over a network
  • SSH
    Secure Shell - a network communication protocol that enables two computers to communicate and share data
  • PHP Features
    • Variables
    • Operators
    • Control Structures
    • Functions
    • Arrays
    • Forms Handling
  • Integrating with Web Applications
    1. Server-Side Processing - dynamically generate web content, handle user authentication, interact with databases
    2. Database Interaction - connect to databases like MySQL, PostgreSQL, SQLite to perform CRUD operations
    3. Session Management - manage user sessions and cookies to maintain state across multiple requests
    4. File Handling - manipulate files and directories on the server
  • User Sessions
    • A series of "user actions" performed by an individual on your website or web application within a specific timeframe
    • The user stays on your website
    • The user session lasts only for a certain amount of time (the standard is 30 minutes)
  • Cookies
    • Text files with small pieces of data (like username and password) that identify your computer as you use a network
    • Specific cookies are used to identify specific users and improve their web browsing experience
  • Learning Resources
    • Documentation - official PHP documentation (php.net)
    • Tutorials and Courses - online tutorials, courses, and books
    • Community Support - forums, user groups, and Q&A platforms