Search

Sunday, November 24, 2013

APPCRASH php-error-faulting-module-name-php5ts[solved]

Problem signature:
  Problem Event Name:    APPCRASH
  Application Name:    httpd.exe
  Application Version:    2.4.4.0
  Application Timestamp:    5128b049
  Fault Module Name:    php5ts.dll
  Fault Module Version:    5.4.16.0
  Fault Module Timestamp:    51af9dd2
  Exception Code:    c0000005
  Exception Offset:    0002c202
  OS Version:    6.1.7601.2.1.0.274.10
  Locale ID:    1033
  Additional Information 1:    0a9e
  Additional Information 2:    0a9e372d3b4ad19135b953a78882e789
  Additional Information 3:    0a9e
  Additional Information 4:    0a9e372d3b4ad19135b953a78882e789


We are running XAMPP on Windows 2008 R2 64bit.  We received APPCRASH every 7 or 8 hours. I tried lots of solution by but situation is same. After long time I found solution:

SOLUTION: After long time I found solution I changed the configuration and run the PHP in cgi mood.

Set Comment on following line.
#LoadFile "D:/xampp/php/php5ts.dll"
#LoadModule php5_module "D:/xampp/php/php5apache2_4.dll"

#<FilesMatch "\.php$">
#    SetHandler application/x-httpd-php
#</FilesMatch>
#<FilesMatch "\.phps$">
#    SetHandler application/x-httpd-php-source
#</FilesMatch>


#
# PHP-CGI setup
#


Uncomment the following line:

<FilesMatch "\.php$">
    SetHandler application/x-httpd-php-cgi
</FilesMatch>
<IfModule actions_module>
    Action application/x-httpd-php-cgi "/php-cgi/php-cgi.exe"
</IfModule>


After changing this configuration I will never received APPCRASH. My problem is solved.


Moodle and mod_rewrite are running perfectly in CGI mood.






Thursday, November 17, 2011

PHP CODE to Find MAC Address and HOST Name

Using following code will help you find MAC Address and Host Name of Selected IP.  To execute following code you need to change the security permission of cmd.exe
Go to \Windows\System32\cmd.exe right click on it and select properties. Select user Internet Guest Accounts/IUSER….
Then add the full control. Follow the picture.
<?php
$hostname = gethostbyaddr(trim('25.8.100.5'));
$ip = '25.8.100.5';

SYSTEM(`ping $ip -n 1 && arp -a`);
$output = `arp $ip -a`;
$line = $output;

$pos = strpos("$line","$ip");

$mac = str_replace("$ip","", $line);
$mac1 = str_replace("dynamic","", $mac);
$mac2 = trim(substr($mac1,86));

    if ($ip == $hostname)
        {
            $host = '';  
        }
        else
        {
            $host = $hostname;  
        }
echo 'Host Name   :    ', $host;
echo '<BR>';
echo 'Mac Address :    ', $mac2;

?>

PHP CODE PING IP or HOST

Using following code you can ping host name/ IP Address.  To execute following code you need to change the security permission of cmd.exe
Go to \Windows\System32\cmd.exe right click on it and select properties. Select user Internet Guest Accounts/IUSER….
Then add the full control. Follow the picture.

<body>
<?php
   $host   = "www.yahoo.com";
   echo("Ping Output:<br>");
     
      echo '<pre>';          
     
        system("ping -n 3 $host");
      echo '</pre>';
?>
</body>

Note: you can ping IP address/hostname using this script.

Wednesday, November 16, 2011

VB.NET Send Mail Code

Following coding used to send mail from VB.NET using GMAIL Accounts.

  Imports System.Net.Mail

  Dim SmtpServer As New SmtpClient()
        Dim mail As New MailMessage()
        Dim sMsg1, sFooter As String
        Dim sTo, sMailuser, sPassword As String
       
        Try
            sMailuser = "rezbait@gmail.com"
            sPassword = "Account Password" 'Password of mail.
           
sMsg1 = " This is test mail from GMAIL account. "
            sFooter = "<BR><BR>This is footer."
            sTo = "rezbactg@yahoo.com"

            SmtpServer.Port = 587
            SmtpServer.Host = "smtp.gmail.com"
            SmtpServer.EnableSsl = True
           
SmtpServer.Credentials = New  _
            Net.NetworkCredential(sMailuser, sPassword)

            mail = New MailMessage()
            mail.From = New MailAddress(sMailuser)   'From Address
            mail.To.Add(sTo)  ' To Address
            mail.Subject = "Subject of Mail " 'Subject of Mail.
            mail.Body = sMsg1 + sFooter
            mail.IsBodyHtml = True
            SmtpServer.Send(mail)
            MsgBox("Mail Sent.")
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try

VB.NET MySQL (Insert Picture in Blob Field)

Following coding will help you to insert picture from VB.NET to MySql BLOB field. Coding is very simple.

First you need to install MyODBC for your windows. Installation is very simple. You can download MyODBC from following link:


Create table statement for MySQL.

CREATE TABLE `picture` (
  `ID` int(32) unsigned NOT NULL auto_increment,
  `Picture` longblob,
  `EmployeeID` varchar(10) default NULL,
  PRIMARY KEY (`ID`),
  UNIQUE KEY `ID`(`ID`),
  KEY `ID_2`(`ID`)
) TYPE=MyISAM;

VB.NET CODE:

Imports System.IO        'Write this coding before Class declaretion.
   
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

  Dim cmd As New Odbc.OdbcCommand
  Dim SQL As String
  Dim rawData() As Byte
  Dim fs As FileStream
  Dim sPath As String
 
  Dim connectionString As String = "Driver={MySQL};" & _
        "Server=server_name;" & _
        "Database=DSN_Name;" & _
        "Uid=root;" & _
        "Pwd=root;" & _
        "OPTION=16427"

  Dim conn As New Odbc.OdbcConnection(connectionString)

  sPath = txtPicturePath.Text

  fs = New FileStream(sPath, FileMode.Open, FileAccess.Read)
  rawData = New Byte(fs.Length) {}
  fs.Read(rawData, 0, fs.Length)
  fs.Close()
  conn.Open()
   
SQL = "INSERT INTO Picture(EmployeeID, Picture) VALUES('" & TxtID.Text & "', ?)"
 
  cmd.Connection = conn
  cmd.CommandText = SQL
  cmd.Parameters.Add("@bin_data", rawData)
  cmd.ExecuteNonQuery()

  conn.Close()
End Sub
If above code work please share the link.

Tuesday, November 15, 2011

SYSTEM ICON PROBLEM


Few days ago, my power, network, and volume icons disappeared from the tray area of Windows 7.  When I chose “Customize notification icons” and then “Turn system icons on or off”, the choices were grayed out like the image to the left.
I tried the Group Policy and registry solutions that I found online, but with no success.
Here’s how I finally fixed it:
  1. Run a Command Prompt as administrator, then “sfc /scannow
  2. Find the sfc log file at C:\Windows\Logs\CBS\CBS.log and search it for “cannot repair”.
I discovered that 6 .dll files from C:\Windows\system32 were messed up.  I found a nice explanation here as to how to extract the files from the Windows 7 installation DVD using 7-Zip, which I already like for other zipping and unzipping tasks.
Unfortunately, you can’t just copy the files into C:\Windows\system32.  Here’s what I had to do to replace the .dll files:
  1. Extract the files from the installation DVD into a local folder, such as c:\extracted-files
  2. Boot the installation DVD, choose to repair Windows, and get to a Command Prompt
  3. Use the command line to copy the .dll files from c:\extracted-files to c:\windows\system32
  4. Reboot
It will solve the problem of System icon.

VB.NET & MySql Connection (ADODB)


Some time when we search for VB.NET MYSQL Connection in internet we found lots of complicated solutions. I also face same problem. That’s why I would like to share my experience with you.  I hope it will also help for you.

You need to install MyODBC 2.5 or later version need to install. Check the MyODBC version in following link:

Or You can just extract the MyODBC zip file and copy the MYODBC.DLL into System32 folder.

http://84.113.22.230:8980/mysql/downloads_html/api-myodbc-2.50.html

Add References of ADODB (Project Add References).

Coding:
  Dim con As New ADODB.Connection
        cst = "Driver={MySQL};" & _
        "Server=server_name;" & _
        "Database=Database_Name;" & _
        "Uid=userid;" & _
        "Pwd=password;" & _
        "OPTION=16427"

        con.Open(cst)
     con.CursorLocation = ADODB.CursorLocationEnum.adUseClient
Sample data retrieve in Grid:
Dim iRow As Integer
Dim rs As New ADODB.Recordset
Dim qrystr As String

qrystr = "Select EmployeeID, Name From Employee Order by EmployeeID"

rs.Open(qrystr, con, ADODB.CursorTypeEnum.adOpenStatic,
                  ADODB.LockTypeEnum.adLockReadOnly)

If rs.RecordCount > 0 Then
   EmployeeGrid.RowCount = rs.RecordCount
   For iRow = 0 To rs.RecordCount - 1
EmployeeGrid.Item(0, iRow).Value = rs.Fields("EmployeeID").Value EmployeeGrid.Item(1, iRow).Value = rs.Fields("Name").Value
      rs.MoveNext()
   Next
 Else
      EmployeeGrid.RowCount = 1
      EmployeeGrid.Item(0, 0).Value = ""
      EmployeeGrid.Item(1, 0).Value = ""
 End If

 rs.Close()
 con.Close()