Installing, Configuring PHP and Running PHP scripts

In order to run PHP on your Windows system, you can simply have the required version of regular or debug PHP zip files and extract them.  And then ensure that extracted location is in %PATH% so that Windows starts picking up that particular version of php by defult for running .php scripts/files locally. Example: On the same system you can run multiple versions of PHP side-by-side. C:>php -v PHP 5.3.24 (cli) (built: Apr 10 2013 18:32:42) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies C:>php-5.5.6php.exe -v PHP 5.5.6 (cli) (built: Nov 12 2013 11:35:48) […]

Read more

Understanding how URLs are linked to Code in the HTML pages

Whenever we launch a website in the browser, it then gets modified as we navigate the other elements on that web site page.  We notice that, the modified URL will mostly have the website actual website but with more strings attached to it starting with a ?. Example: We open a main web site  page say http://www.yahoo.com/ Then we navigate to Yahoo mail login page: https://login.yahoo.com/?.src=ym&.intl=us&.lang=en-US&.done=http://mail.yahoo.com    In the above we see the web site of yahoo.com is having URL with   https://login.yahoo.com/   +  ?  + .src=ym&.intl=us&.lang=en-US&.done=http://mail.yahoo.com   This process of URL modification is called the URL encoding.  This is […]

Read more

Connecting to your MySQL Database from a Php page using PDO (PHP Data Objects)

  In order to connect to a MySQL DB from Php, you need to frame the connection string and   Index.php <?php     include_once("config.php"); ?>   Config.php <?php     //set off all error for security purposes     error_reporting(E_ALL);         //define some contstant     define( "DB_DSN", "mysql:host=localhost;dbname=<myDBName>" );     define( "DB_USERNAME", "root" );     define( "DB_PASSWORD", "<myrootpasswordhere>" );     define( "CLS_PATH", "class" );     //include the classes     include_once( CLS_PATH . "/DBClass.php" ); ?>   DBClass.php <?php class DBClass {     public function Connect_mysqlDB(){         try {             $con = new PDO( DB_DSN, DB_USERNAME, DB_PASSWORD );             $con->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION […]

Read more