Tuesday, February 9, 2016

How to Deploy Symfony 2.8 or 3.0 Project on Linux Hosting Server.

After spending several day finally i success to launch my symfony project on share hosting.
Guys ! Its very diffrent to work in xampp / Wamp than Production server in symfony case.


I will tell you story step by step.
I developed a small project in symfony 2.8 which need some ajax call, some CRUD operation.
that project was running like a charm at my localhost. Then finally I upload all files into my shared server under  "public_html" (which turn wrong for me). using this method, some time my page was blank or some time i was geeing un-understandable  error :-).

Finally i got one solution to that work for me on Linux shared hosting .

Follow Below steps
  • Before uploading any thing delete everything under "App/Chache"
  • upload "WEB" folder which is inside of  your symfony Project  into "/public_html"
  • Now Go up one label from /public_html. you  will see  "/"  in remote site path 
  • upload all Remain Folders of your symfony project here. 
  • Never forgot to update your DB Details in " app/config/parameters.yml

Thats it. Go to the url, you will must see the running page.

Note-: i will brief you my Shared Hosting Details which i performed.
  •            Server -: Linux
  •            Type -:    Share hosting at Hioxindia pvt ltd
  •            Framework version-: Symfony 2.8
  •            Localy developed with  Wamp + PHPMyadmin



Here is snap shot of my Test Project 



Tuesday, February 2, 2016

Make Mysql Database Connection using PDO || Very Easy to learn

1.Config.php
<?php
     
        error_reporting(E_ALL);
        try
        {
 $pdo = new PDO('mysql:host='. DB_HOST .';dbname='.$selected_db, DB_USER, DB_PASSWORD);  // with db connect
             $db = new PDO( "mysql:host=localhost", 'root', '' ); without DB.. just an open  connection
        }
        catch (PDOException $e)
        {
            $db='Error: '.$e->getMessage();
            die($db);
        }
        return $db;
?>



2. logic.php
 
   <?php
       $db = include_once('config.php');
        try{
         
         $q_object = $db->query("select password('my_hash_password') as m_password");
     
         $get_data = $q_object->fetch(PDO::FETCH_ASSOC);
         echo '<pre>';
         print_r($get_data);
      }
      catch(PDOException $e){
          echo 'Some Error Found<br />'.$e->getMessage();
          die();
      }