RSS

Category Archives: PHP

Begin Wamp Server At Startup


Go to Control Panel->Administrative Tools-> Services.

Right click wampapache,wampmysqld and select properties.

Change Startup Type from Manual to Automatic

 

 
Leave a comment

Posted by on January 13, 2011 in PHP

 

Tags: , , , , , , ,

Magento Blank Theme Installation Problem


After installing blank theme in magento,an error will appear like this,

Fatal error:Call to a member function toHtml() on a non-object in /app/code/core/Mage/Core/Model/Layout.php on line 529

To fix this error,go to /app/design/frontend/default/blank/layout/ and open page.xml file.

Find the code around line no 89, which looks like this,

<block type="core/profiler" output="toHtml" />

Change it to

<block type="core/profiler" output="toHtml" name="core_profiler"/>
 
Leave a comment

Posted by on December 21, 2010 in Magento, PHP

 

Tags: , , , , , , , ,

Setup PHP Debugger On Komodo Edit 5


komdo-edit

  • To enable PHP debugger on komodo edit,Go to Edit->Preferences->Language->PHP. PHP interpreter path must be setup. INI file path will be automatically configured by komodo edit installer if php ini file exists.
  • Now locate the path of php-cgi.exe file and set its path.In Wamp,php-cgi.exe file will be in wamp\bin\php\php5.2.9\php-cgi.exe
  • Once it done,Komodo Edit will show syntax error while typing the code.
 
4 Comments

Posted by on November 8, 2010 in Opensource, PHP, Tips & Tricks

 

Tags: , , , , , , , , , ,

How to Send Mail From Localhost-PHP


If  you are using wamp in a windows machine,its quite hard to send mail through native php mail function or sendmail or SMTP.But you can use PHP Mailer program to send mail from localhost.It bypasses native mail,sendmail methods.It works well on windows as well as *nix machines.

Download PHP Mailer from http://sourceforge.net/projects/phpmailer/files/phpmailer%20for%20php5_6/ or from http://phpmailer.worxware.com/

Sample code

<?php
require($_SERVER['DOCUMENT_ROOT'].'/phpmailer/class.phpmailer.php');
require($_SERVER['DOCUMENT_ROOT'].'./phpmailer/class.smtp.php');
$mail  = new PHPMailer();
$body="<b>This mail is sent using PHP Mailer</b>";#HTML tags can be included
$mail->IsSMTP();
$mail->SMTPAuth  = true;                 #enable SMTP authentication
$mail->SMTPSecure = "ssl";               #sets the prefix to the server
$mail->Host  = "smtp.gmail.com";         #sets GMAIL as the SMTP server
$mail->Port       = 465;                 #set the SMTP port
$mail->Username   = "";                  #your gmail username
$mail->Password   = "";                  #Your gmail password
$mail->From       = "";                  #your gmail id
$mail->FromName   = "";                  #your name
$mail->Subject    = "Subject of the mail";
$mail->WordWrap   = 50;
$mail->AddAddress("recipient mail id","recipient name");
$mail->IsHTML(true); // send as HTML
if(!$mail->Send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message has been sent";
}

?>

You can also send mail with attachments.For more info refer the documentation of PHP Mailer.

Caution:

Change SMTP Host,port,authentication only if sure of what you are doing.

 
3 Comments

Posted by on October 8, 2010 in PHP, Web Development

 

Tags: , , , , , , , , , , , ,

How To Create an Alias in Wamp


When you install wamp, www will be the default folder to put your site and it will be accessed by http://localhost/site-name.But how can one run site that exists outside www folder.Here ‘s the simple solution

Create a folder in any one of your parititons.Here i have created a folder called trunk in C:\ drive.

  • Right click the wamp icon click and go Apache->Alias directories->add an alias

Wamp-Create-Alias

A new command window will be opened

  • Enter the only(without ant relative or absolute path) the name of the folder that you created and hit enter.

Example:trunk

  • Now specify the path where the folder is located and hit enter.

Example: c:/trunk/

Thats it alias created.Site can be accessed with this url http://localhost/trunk.Store all the files in the folder that you created.

 
1 Comment

Posted by on October 7, 2010 in PHP, Tips & Tricks, Web Development

 

Tags: , , , , ,