Showing posts with label Started with PHP 1. Show all posts
Showing posts with label Started with PHP 1. Show all posts

Tuesday 19 July 2022

Started with PHP 1

 Setting Local Web Server

PHP script executes on a web server running PHP. So before you start writing any PHP program you need the following program installed on your computer.

1)The Apache Web server

2)The PHP engine

3)The MySQL database server

You can either install them individually or choose a pre-configured package for your operating systems like Linux and Windows. Popular pre-configured packages are XAMPP and WampServer.

WampServer is a Windows web development environment. It allows you to create web applications with Apache2, PHP, and a MySQL database. It will also provide the MySQL administrative tool PhpMyAdmin to easily manage your databases using a web browser.

First PHP Script

Now that you have successfully installed WampServer on your computer. In this section, we will create a very simple PHP script that displays the text "Hello, world!" in the browser window.

Ok, click on the WampServer icon somewhere on your Windows taskbar and select the "www directory". Alternatively, you can access the "www" directory by navigating the C:\wamp\www. Create a subdirectory in the "www" directory let's say "project".

<?php // Display greeting message echo "Hello, world!"; ?>


Now save this file as "hello.php" in your project folder (located at C:\wamp\www\project), and view the result in your browser by visiting this URL: http://localhost/project/hello.php.

Alternatively, you can access the "hello.php" file by selecting the localhost option and then selecting the project folder from the WampSever menu on the taskbar.

PHP can be embedded within a normal HTML web page. That means inside your HTML document you can write the PHP statements, as demonstrated in the following example:

<!DOCTYPE HTML> <html> <head> <title>PHP Application</title> </head> <body> <?php // Display greeting message echo 'Hello World!'; ?> </body> </html>


Now save this file as "hello.php" in your project folder (located at C:\wamp\www\project), and view the result in your browser by visiting this URL: http://localhost/project/hello.php.

Alternatively, you can access the "hello.php" file by selecting the localhost option and then selecting the project folder from the WampSever menu on the taskbar.

PHP can be embedded within a normal HTML web page. That means inside your HTML document you can write the PHP statements, as demonstrated in the following example:
















Microsoft Thwarts Chinese Cyber Attack Targeting Western European Governments

  Microsoft on Tuesday   revealed   that it repelled a cyber attack staged by a Chinese nation-state actor targeting two dozen organizations...