Upgrade to PHP 7.0 on Ubuntu

Ref : https://www.stewright.me/2016/03/upgrade-php-7-0-ubuntu/

Prerequisites and disclaimer

My server is a Ubuntu 14.04 box that uses Apache 2.4 and PHP 5.5.9 prior to upgrade. These instructions are for Apache 2.4 users with a similar configuration, and I recommend you test in isolation before using in a production environment. Proceed at your own risk.

Step 1 – Add a new Apt source

At the time of writing, I’m using the packages maintained by a guy called Ondřej Surý (he’s worth a follow on Twitter) until there’s a Debian package for PHP 7 in the official release channels.

To do this, enter the following command into the box you’re upgrading:

sudo add-apt-repository ppa:ondrej/php

You’ll probably be prompted to enter your password at this point. Go ahead and enter it.

Step 2 – Install updates and the PHP 7.0 package

Next we’re going to update and upgrade packages on our system to ensure everything goes smoothly. You can do this in a single command with:

sudo apt-get update && sudo apt-get upgrade

Once this has finished, we’re ready to install PHP 7.0. Enter the following command into your terminal:

sudo apt-get install php7.0 php7.0-mysql libapache2-mod-php7.0 php7.0-mcrypt php7.0-curl

This will install PHP 7.0, along with a number of commonly used PHP packages including the Apache PHP 7 module. I found that everything else pretty much worked without being installed separately. That’s it pretty much. You shouldn’t need to make any configuration changes and everything should just work.

Step 3 – Test to ensure your server is using PHP 7.0

From the command line, type the following command:

php -v

Checking the passing data array ( Debugging at the PHP and Javascript )

PHP Page တစ္ခုေရးတဲ႕ အခါ Database ထဲကေန Select ယူလုိက္တဲ႕ Data ေတြကို ဘယ္လုိပါလာသလဲ သိခ်င္သည္႔ အခါ ….
print_r(array_name);  Or echo var_dump(array_name);

အေနနဲ႕ ထုတ္ယူၿကည္႔ရႈႏုိင္ပါသည္ …..

print_r(array_name);  Or echo var_dump(array_name);  ေရးၿပီးသည္႔ အခါ
exit(); ၿဖင္႔ လက္ရွိေနရာမွ ထြက္လွ်င္ က်န္ရွိေသာ အလုပ္မ်ားဆက္မလုပ္ေတာ႔ ဘဲ လက္ရွိ run ေနသည္႔ကုိ ရပ္တန္႔သြားပါလိမ္႔မည္ ..

eg .

<?php
$con=mysqli_connect(“myexample.com”,”william”,”db123″,”my_db”);
// Check connection
if (mysqli_connect_errno())
{
echo “Failed to connect to MySQL: ” . mysqli_connect_error();
}

$result = mysqli_query($con,”SELECT * FROM Persons”);

echo <table border=’1′>
<
tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>”;

while($row = mysqli_fetch_array($result))
{

 var_dump($row);
echo “<tr>”;
echo “<td>” . $row[‘FirstName’] . “</td>”;
echo “<td>” . $row[‘LastName’] . “</td>”;
echo “</tr>”;
}
echo “</table>”;

mysqli_close($con);
?>

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Javascript  ေရးသည္႔ အခါလည္း  PHP မွသယ္လာေသာ Data မ်ားကို စစ္ၿကည္႔ခ်င္သည္႔ အခါ …..
php မွ server ဆီသို႕သြားၿပီး သယ္ယူလာလည္႔ data မ်ားကို  json format အေနနဲ႔ေၿပာင္းၿပီး  alert(data1.join(“\n”)); အေနနဲ႕ ထုတ္ယူၿကည္႔ရႈႏုိင္ပါသည္

var data1 = <?php echo json_encode(test()); ?>;
 alert(data1.join(‘\n’));

<?php function test()
{
return $arrData;
}
?>

Wamp Server ႏွင္႔ MySql ကို Run မရၿခင္း

Windows 7 32 bits  and WampServer 2.2
PHP 5.3.13
Apache 2.2.22
MySql 5.5.2

Windows မွာ Visual Studio 2010 ႏွင္႔ SqlServer 2008 တင္ၿပီးသည္႔ အခါ Wamp Server ကို
Browser မွ Run သည္႔ အခါ localhost ၿဖင္႔ေခၚလုိ႔မရၿဖစ္ခဲ႕လွ်င္ …..

Wamp Server အတြက္

Web Server Run သည္ႏွင္႔ ဆက္စပ္မႈရွိေသာ  Microsoft Services မ်ားအခ်ဴိ႕ကို  Stop လုပ္ဖုိ႔ လိုအပ္ ပါသည္ …
eg.
MSSQLSERVER services
Firewall Service
IIS သြင္းထားခဲ႔လွ်င္  IIS အတြက္ Run ထားေသာ web services မ်ားကိုလည္း ပိတ္ဖုိ႔ လိုအပ္ ပါသည္ …
Skype တို႕ကဲ႔သို႔ေသာ port 80 ကို ယူသံဳးေသာ application မ်ားရွိလွ်င္လည္း ပိတ္ဖုိ႔ လုိအပ္ ပါသည္ ….

အကယ္၍ …. Wamp Server ရဲ႕ Port 80 ကို တစ္ၿခား Port ေၿပာင္းသံုးလုိလ်ွင္ေတာ႔ …. Apache ရဲ႕ httpd.conf file ထဲမွ Port 80 ကို ေၿပာင္းလုိေသာ Port No တစ္ခုသုိ႔ေၿပာင္းၿပီး  localhot:8080/ အေနၿဖင္႔  Browser မွေခၚၿပီး Run လွ်င္ရပါႏုိင္ပါသည္ ( httpd.conf file path => C:\wamp\bin\apache\apache2.2.22\conf\httpd.conf)

PhpMyadmin ကို Browser မွ ေခၚ၍မရခဲ႕လွ်င္ ……

Change the file content of c:\wamp\alias\phpmyadmin.conf to the following.

<Directory "c:/wamp/apps/phpmyadmin3.4.5/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order Deny,Allow
        Allow from all
</Directory>

Here my WAMP installation is in the c:\wamp folder. Change it according to your installation.

Previously, it was like this:

<Directory "c:/wamp/apps/phpmyadmin3.4.5/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1
</Directory>

Running only one server but installed both Wamp Server and IIS on a machine ( Windows 8 – X64 bits )

Running only one server but installing both Wamp Server and IIS on a machine 

To run IIS and close Wamp Server 

1) Close services ( wampapache and wampmysqld ) .

2) Open services ( IIS Admin Service , Web Development Agent Service and World Wide Web Publishing Service ) .

———————————————————————————————————————–

To run Wamp and close IIS Server 

1) Open services ( wampapache and wampmysqld ) .

2) Close services ( IIS Admin Service , Web Development Agent Service and World Wide Web Publishing Service ) .