Define PHP and How to work?

Type of website:-

A static page is called that in which the information that is there is in the name of every user. You cannot change anything in a static page. It is only used to see information.

Dynamic website:-

Dynamic website is user-friendly, user can interact with it. The page in which the user can interact is called a dynamic website. Like submitting a form by filling in a web page. In this, each user gives different information, the user who enters the information gets the same result.

How PHP works?

There is a client who sends a request or works to visit a website.

web server

The webserver provides us this facility which will be there for 24 hours. So that your client will be able to send that request by any time difference and its corresponding web server will be able to respond to it. A server will run in the webserver which you call Apache server.

This is the web server, this is your small storage in which you have a database created. In which your own server is running which supports PHP. As a programmer, whatever site he has developed is the content of the whole site or is it accessories, They give way by storing them in their web server. You will also create a database so that the user can access it anytime.

client > apache> PHP> database> PHP> Apache> client

Development environment

Operating system – Windows, Linux, Mac, etc.

Web server – XAMP, WAMP, MAMP etc.

Editor/IDE- Notepad, Notepad++, notepad, brackets, eclipse etc.

Web browser – chrome, Firefox etc.

MySQL

MySQL ek database management system hai, is a kind of software in which you write MySQL. MySQL is a software and SQL is a language.

When you install XAMPP, you get:
Apache + MariaDB + PHP + Perl

Apache + MySQL + PHP + Perl

The basic structure of PHP

<?php   opening markup/ Opening tag

php codes;

?> closing markup/ closing tag

Whatever is written between these two is called php code.

We can write Php with HTML

<!DOCTYPE html>
<html>
	<body>
		<h1><body>DevOpsSchool</h1>
	<?php
		echo'hello devopsschool';
	?>
	
	</body>
</html>

How to run on the local server

If you have to run the PHP file in the local server, then first you have to open the XAMMP control panel, then you have to open apache and MySQL in it, this is the first thing. After that you have to go to this puck, then where you have saved the XAMMP file, you have to open the sump file, after that you have to open the htdos. After that you have to go to this PC, then open the file where you have saved XAMPP. After that htdcos has to be opened. Your project will have to create a file, all your files will be made from PHP, HTML, ccs, javascript, audio, images, videos, etc. Then go to your browser and open localhost, then type the name of your project in it and open it. After that, your PHP file will start running.

Tagged : / / / /

Not Found The requested URL was not found on this server.

Apache/2.4.46 (Win64) OpenSSL/1.1.1g PHP/7.2.34 Server at ds-student-ms Port 80

In this tutorial I’m going to describe how to solve this error

Not Found The requested URL was not found on this server Apache/2.4.46 (Win64) OpenSSL/1.1.1g PHP/7.2.34 Server at ds-student-ms Port 80.

I got a error when i created virtual host and when i Open in browser its showing Not found the requested url.

I tried lots of then i got what’s the error on my project Simply go to your project directory

C:\xampp\htdocs\ds-student-ms\public\.htaccess

Simply open this file in editor and paste below code.

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>

RewriteEngine On

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

Now refresh your browser and you can see its open correctly

Thanks its helpful for you.

Tagged : / / /

General error: 1364 Field ‘phone’ doesn’t have a default value

SQLSTATE[HY000]: General error: 1364 Field ‘phone’ doesn’t have a default value (SQL: insert into `products` (`name`, `email`, `address`, `image`, `updated_at`, `created_at`) values (amti, kuam@gmail.com, sdafasdf, 642917381.jpg, 2021–05–11 10:58:35, 2021–05–11 10:58:35))

When I’m submit form then got General error field doesn’t have default value. let’s go to solve this.

👉 1 step go to your database and put change none>to Null and save.

Lets go to phpmyadmin

👉 Click on Structure

Click on change and change all field to None to Null and save

Set Null and click on save button

👁👁 Now its error has been solved and your data has been stored successfully.

Thanks

Tagged : / / / / / /

Fatal error: Maximum execution time of 300 seconds exceeded in C:\xampp\phpMyAdmin\libraries\classes\Dbi\DbiMysqli.php on line 199

Whenever you import file in in database then after some processing time its show you have using Maximum execution time of 300 seconds exceeded will be showing this type of error in your database:

First of all stop your Xampp

Next step : go to config.default.php

Once that’s done get back to finding phpMyadmin config file named something like “config.default.php”. On XAMPP you will find it under “C:\xampp\phpMyAdmin\libraries” folder. Open the file called

config.default.php and set :

$cfg['ExecTimeLimit'] = 0;

Simply paste here..

Once set, restart your MySQL and Apache and go import your database.

Tagged : / / / /

How to fix fatal error: Maximum execution time of 300 seconds exceeded in XAMPP

Step1: Go to this path C:\xampp\phpMyAdmin\libraries

Step2: open file config.default.php

Step3: config.default.php on this line $cfg[‘ExecTimeLimit’] = 300; change

Step4: config.default.php on this line $cfg[‘ExecTimeLimit’] = 0; change

Step5: XAMPP Will be Restart and Import the Sql file.

Tagged : /

How to Create Virtual Host in Laravel

In this tutorial I’m going to create multiple virtual host in laravel in some easy steps please follow mentioned below.

first stop your xampp 👇

1step-> Go to

C:\xampp\htdocs

ds-admin-ms is your project folder name

ds-admin-ms

2nd step go to

C:\xampp\apache\conf\extra

3rd step Open this file -> httpd-vhosts.conf

4th step Copy below code 👇👇

<VirtualHost *:80>
DocumentRoot "C:\xampp\htdocs\ds-admin-ms\public"
ServerName ds-admin-ms
ServerAlias ds-admin-ms
<Directory "c:/xampp/htdocs/ds-admin-ms/public">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

Next step go to

C:\Windows\System32\drivers\etc

Open this file -> hosts

Simply copy below code 👇

127.0.0.1 		ds-admin-ms
::1

Paste here in C:\Windows\System32\drivers\etc and open this file 👉 hosts

Lets go to xampp and start run

and go to folder -> C:\xampp\htdocs\ds-admin-ms

and open terminal and run

php artisan serve

Next go to browser and paste this

http://ds-admin-ms/

Tagged : / / /

How to create virtual local host setup in Laravel

In this tutorial I’m going to describe how to set up virtual host in Laravel. Please follow this Tutorial and you able to create successfully virtual host in Laravel

1. Go to C drive and Go to this Directory-> C:\xampp\apache\conf\extra and open httpd-vhosts name of folder

Virtual-host-in-laravel

Open this folder -> httpd-vhosts

2nd Step Copy Below Code

👇

<VirtualHost *:80>

DocumentRoot “C:/xampp/htdocs/blog/public”

ServerName localhost

</VirtualHost>

<VirtualHost *:80>

DocumentRoot “C:/xampp/htdocs/blog/public”

ServerName blog.co

</VirtualHost>

☝️

and paste simply there in this folder -> httpd-vhosts

3rd Step go to windows C:\Windows\System32\drivers\etc and open hosts folder

4th step simply copy this

👇

127.0.0.1 localhost

127.0.0.1 blog.co

And paste this folder

👇

After stop your xampp apache server and start then

And start then Xampp Apache server

And run blog.co now you can see blog.co localhost set up is done.

Thanks …… 🙂

Tagged : / / / /