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

Thursday, April 23, 2026

Error in importing database in drupal - Missing expression. (near "ON" at position 25) - XAMPP - set foreign_key_checks on error

Missing expression. (near "ON" at position 25)

MYSQL

SET FOREIGN_KEY_CHECKS = ON;



Solution:-
Change max_allowed_packet=1 to max_allowed_packet=1024M in MY.ini
in PHP.ini add these four lines
 max_execution_time = 600
max_input_time = 600
memory_limit = 1024M
post_max_size = 1024M
upload_max_filesize=1024M

Also please check below link:-

Wednesday, April 8, 2026

How to install drupal - How to run a website made in drupal

 Add this line in settings.php

$config['system.image']['toolkit'] = 'gd';

uncomment this line(for showing error log )

$config['system.logging']['error_level'] = 'verbose'; 

Customize below code

$databases['default']['default'] = array (

  'database' => 'rni_web',              //write data base that is blank, for new installation

  'username' => 'root',

  'password' => '',

  'prefix' => '',

  'host' => 'localhost',

  'port' => '3307',

  'namespace' => 'Drupal\\mysql\\Driver\\Database\\mysql',

  'driver' => 'mysql',

  'autoload' => 'core/modules/mysql/src/Driver/Database/mysql/',

);


1) write data base that is blank, for new installation ( 'database' => 'rni_web',  )

2) after next , you will get errors  of gd than see below link

https://kapooryash.blogspot.com/2026/04/error-while-starting-my-sql-or-appache.html

3) if drupal new install than use it with that database, if website already modified or given by some other person than change database name with backup database(replace  ( 'database' => 'rni_web',  ) with other database)

Thursday, April 2, 2026

Error while starting My sql or Appache in Xampp server

 https://webolute.com/blog/programming/this-may-be-due-to-a-blocked-port-missing-dependencies/


and for My sql, use below steps

Open the XAMPP Control Panel and click Config next to MySQL, then select my.ini.

Find the lines port=3306 (usually in two places) and change them to port=3307.


next step

If going to localhost:8000 get error than change the config.inc.php, enter the password in string $cfg['Servers'][$i]['password'] = 'root';

and change

$cfg['Servers'][$i]['controluser'] = 'pma'; to  $cfg['Servers'][$i]['controluser'] = 'root';

$cfg['Servers'][$i]['controlpass'] = '';$cfg['Servers'][$i]['controluser'] = 'root';


=========================================
C:/xampp/php/php.ini
C:/xampp/apache/conf/httpd.conf
C:/xampp/mysql/bin/my.ini
C:/xampp/phpMyAdmin/config.inc.php
These above 4 files are changed.

C:/xampp/phpMyAdmin/config.inc.php
/* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'root';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Lang'] = '';

/* Bind to the localhost ipv4 address and tcp */
$cfg['Servers'][$i]['host'] = '127.0.0.1:3306';
$cfg['Servers'][$i]['connect_type'] = 'tcp';

/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'root';
$cfg['Servers'][$i]['controlpass'] = 'root';

and for xampp server- default password is blank
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Lang'] = '';

/* Bind to the localhost ipv4 address and tcp */
$cfg['Servers'][$i]['host'] = '127.0.0.1:3307';
$cfg['Servers'][$i]['connect_type'] = 'tcp';

/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'root';
$cfg['Servers'][$i]['controlpass'] = '';
 
=======================
C:/xampp/mysql/bin/my.ini - How to change the port of Mysql in xampp
port=3306
socket="C:/xampp/mysql/mysql.sock"

# Here follows entries for some specific programs 

# The MySQL server
default-character-set=utf8mb4
[mysqld]
port=3306
socket="C:/xampp/mysql/mysql.sock"
basedir="C:/xampp/mysql"

C:/xampp/apache/conf/httpd.conf(How to change port of Appache server in xampp) 
For changing https port
Listen 80 -- change here
ServerName localhost:80

C:/xampp/php/php.ini
if getting error "plugin does not exist. Valid plugin IDs for Drupal\Core\ImageToolkit\ImageToolkitManager are: gd in Drupal\Core\Plugin\DefaultPluginManager-"
1) Press Ctrl + F and search for ;extension=gd.
2) Remove the semicolon (;) at the beginning of the line so it looks like this: extension=gd.
3) restart xaamp server
and
Add or uncomment the following line in your php.ini file: zend_extension=opcache.
Verify Settings: Ensure opcache.enable=1 is set in your php.ini.

c:\xampp\apache\conf\extra\httpd-ssl.conf
SSL port 4443

c:\xampp\apache\conf\extra\httpd-xampp.conf
if appache is not running than change this file.

c:\xampp\mysql\bin\my.ini
port=3307

C:\xampp\htdocs\PRGIWebsitedrupal\sites\default\settings.php
$config['system.image']['toolkit'] = 'gd';

For more drupal settings, please see link below.

Note:- In settings.php file port can be 3306 of Mysql workbench client and In My.ini port can be different(3307) because appache server my sql is different and mysql workbench is different.

Friday, October 20, 2023

How to use session in PHP

 Session::put('APPLICANT_PHONE', $applicant_phone);


$applicant_phone = $request->session()->get('APPLICANT_PHONE');



Session::put('otp_session', $otp);

Thursday, December 1, 2022

Serial number grid PHP

  <?php

$s=mysql_query("SELECT * FROM  bus_detail where source_point='$_SESSION[source_point]' && destination_point='$_SESSION[destination]'");
$counter = 0;
while($row=mysql_fetch_array($s))
{
?>    
 <tr>
<td><?php echo ++$counter; ?></td>
<td><?php echo $row['bus_name'];?> </td>    
<td><?php echo $row['bus_no'];?></td> 
</tr>
<?php }?>


reference:- https://stackoverflow.com/questions/20322869/how-to-create-serial-number