Php program for open source lab

Embed Size (px)

Citation preview

  • 7/27/2019 Php program for open source lab

    1/6

    Reg. No : 50410104020

    PHP with MYSQL

    Install php using the following command# yum install php

    Install Apache using the command#yum install httpd

    To start or stop the Apache server use the command#/etc/init.d/httpd start

    #/etc/init.d/httpd stop

    Type the php program and save the file with the extension .php To enter into mysql connection use mysql u rootp. To create a database use create database database_name;. And then create a table

    with the required fields.

    Move the programs to the location /var/www/html/ If the access permission is denied then change the access permission of the file using

    the command chmod 777 file_name .

    Output can be viewed in the web browser by entering the urlhttp://localhost/filename.php

    Program :

    REGISTRATION FORM USING PHP AND MYSQL

    STEPS TO CREATE THE DATABASE :

    Open the terminal Change to super user using the command SU and enter the password To access or open mysql give the command mysql Now create a database in the name stud use the command create database stud After creating the database , create a user to access the mysql from the apache server

    by giving the command create user admin@localhost identified by admin123; .

    In order to grant access to the created user ( admin ) to access the database file use thecommand grant all on stud.* to admin; .

  • 7/27/2019 Php program for open source lab

    2/6

    Reg. No : 50410104020

    To see the created database use the command show databases;

  • 7/27/2019 Php program for open source lab

    3/6

    Reg. No : 50410104020

    Now quit mysql using the command quit

    use the command mysql u adminh loccalhostp and enter into the mysql bygiving the password.

    use show databases; to check that the database has been created.

  • 7/27/2019 Php program for open source lab

    4/6

    Reg. No : 50410104020

    Use the command use stud to use the created stud database Then create the table in the name student with the required fields

    FORM.PHP

    Sign up Form

    Reg No.:

    Name:

    emailid:

    phoneno:

  • 7/27/2019 Php program for open source lab

    5/6

    Reg. No : 50410104020

    CONNECT.PHP

  • 7/27/2019 Php program for open source lab

    6/6

    Reg. No : 50410104020

    Now go back to the terminal and use the command select* from student; to checkdata entered into the database.