how to move your php development environment to linux (Debian/Ubuntu)
Nowadays, lots of php developers are thinking to move their development environment to linux. And I am writing this tutorial for them. As I like Debian GNU/Linux (www.debian.org) best and ubuntu (www.ubutnulinux.org) is now doing great, in this tutorial I am using the commands for debian & ubuntu.
Ok, now starting:
First on all let’s make a list of software a PHP developer need mostly:
1.Apache
2.PHP
3.Mysql
4.PHP IDE
Ok, let’s start with Apache. Debian & ubuntu use APT to manage the packages. You can easily install apache using apt, here is the command
Debian user:
su
Ubuntu user:
sudo su
Rest of the command ar same for both debian & ubuntu.
apt-get install apache2
It will install all the apache2 & all the related packages (software)
If you need to enable mod_rewrite, follow this link
Now install the PHP
Apt-get install php5 libapache2-mod-php5
This will install the php5 and configure your apache2 server for PHP. You don’t need to do anything.
Lets test the server, if it working ok.
touch /var/www/info.php
Chown www-data:www-data info.php
Now edit this info.php with your feviourate editor and add write code to show phpinfo():
and now browse http://localhost/info.php from your browser. Now check if all your requested library are installed.
if you need any more library, you can check if it already available on your debian/ubuntu package list.
apt-cache search php5-
then you will get the list of available php5 library. Now simple use this command to install it.
apt-get install php5-gd
(example, if you want to install php5 GD library)
Remember: after installing every extra packages, you must need to restart apache server
/etc/init.d/apache2 restart
Ok, so you have now apache2 and php5 installed system. Let’s install mysql:
apt-get install mysql-server-5.0 php5-mysql
It will install all the necessary packages to run mysql-server.
Now restart your apache to take effect.
Complete!!!! Server is allmost ready.
Now i am going to derive how you will transfer your old code to this new environment. Belive me it’s too simple, so don’t worry.
First of all copy your source code to /var/www, here is the details procedure:
mkdir /windows
Here we make a folder for C drive of windows to mount.
mount /dev/hda1 /windows
then we mount the C drive to windows folder (here i use hda1 as example, if your hdd is sata then it will be sda1)
cp -r windows/Apache2/htdocs/xyz /var/www
here we copied our xyz site to /var/www (in debian and ubuntu, default apache2 root folder is /var/www)
cd /var/www
chown -R www-data:www-data xyz
Now change the ownership to www-data
Now we need to move the mysql database, there is two way:
1.use phpmyadmin
2.simple copy the database from data folder
I am deriving the 2nd way.
cp -r /windows/Mysql/data/xyz /var/lib/mysql
chown -R mysql:mysql /var/lib/mysql/xyz
You are done.
PHP Ide for linux environment:
-
1.Zend ( i personaly use this)
2.PHPEd
3.PHPEclipse
4.quanta plus
5.emacs
6.vi
7.PHPedit
***I know this tutorial needs more edit, please make your comments if you got anything wrong, or missed anything. I want it a cool tutorial for php developers.
Read some reviewed, the best and most affordable php hosting solutions on the market.
Nice Tutorial!
This is as easier as it gets in Debian/Ubuntu.
When you have time, plz make one for some other distros, e.g. Fedora too.
I think you could make it more simple, for example if you install software like XAMPP, that will do everything for you. 🙂
বড়ই খটমটে বà§à¦¯à¦¾à¦ªà¦¾à¦°à¥¤ বà§à¦à¦¤à§‡ পারলাম না।
@omi: thanks, i forget to tell about xampp 🙂
btw, i don’t like xampp (lot’s of bad experince with it)
Belive me, i am runing 2 dedicated servers.
Nice Tutorial.
good effort to shine light on the topic,keep it up
hi lavlu, great work. it is so good to see how people with a burning passion also are good teachers and can give the best guidelines. it seems that the php team now is overflowing with passion and burning interest.
@arild
hey, php team was always overflowing with passion compared to your other teams, eh!
see lavlu, x-hasin, morshed, mizan – all are guiding others in their blog!
Very good effort 🙂 and also a useful post for PHP developers. keep up such good tutorials always.
Installing XAMPP is easy as it hides all complexity. But as a developer everyone should know the manual installation and what’s actually going on the back end.
আমি উবà§à¦¨à§à¦Ÿà§ যখন ইউজ করেছিলাম তখন উবà§à¦¨à§à¦Ÿà§à¦° সারà¦à¦¾à¦° সিডি থেকে পিà¦à¦šà¦ªà¦¿ ,মাইà¦à¦¸à¦•à¦¿à¦‰à¦à¦² তার পর পিà¦à¦šà¦ªà¦¿à¦®à¦¾à¦‡à¦à§à¦¯à¦¾à¦¡à¦®à¦¿à¦¨ ইনসà§à¦Ÿà¦²à¦•à¦°à§‡ মোটামà§à¦Ÿà¦¿ লà§à¦¯à¦¾à¦®à§à¦ª LAMP(Linux Apache Mysql PHP) বানিয়ে ফেলেছিলাম । আমার জà§à¦®à¦²à¦¾ , ওয়ারডপà§à¦°à§‡à¦¸ পিà¦à¦‡à¦šà¦ªà¦¿à¦¬à¦¿à¦¬à¦¿à¦° ইনসà§à¦Ÿà¦²à§‡à¦° হাতেখড়ি ওখান থেকেই। তবে লিনাকà§à¦¸à§‡ xampp টà§à¦°à¦¾à¦‡ করিনি।
তবে নতà§à¦¨ বà§à¦¯à¦¬à¦¹à¦¾à¦°à¦•à¦¾à¦°à§€à¦¦à§‡à¦° জনà§à¦¯ xampp à¦à¦¾à¦²à§‹à¥¤ আর আপনার লিনাকà§à¦¸à§‡ যদি নেট কানেকশন না থাকে তবে লাà¦à¦²à§à¦à¦¾à¦‡ à¦à¦° উলà§à¦²à§à¦¯à§‡à¦–িত পà§à¦¯à¦¾à¦•à§‡à¦œà¦—à§à¦²à§‹ আপনি Ubuntu Server Edition সিডি থেকে ইনসà§à¦Ÿà¦² করতে পারবেন।
http://www.ubuntu.com/products/WhatIsUbuntu/serveredition
সিডিটি ডাউনলোড করে Synaptic Package Manager ঠগিয়ে রিপোজিটরিতে সারà¦à¦¾à¦° সিডিটি à¦à§à¦¯à¦¾à¦¡ করে সিনাপটিকের পà§à¦¯à¦•à§‡à¦œ লিসà§à¦Ÿà¦Ÿà¦¿ রিফà§à¦°à§‡à¦¶ করলে উকà§à¦¤ à¦à§à¦¯à¦¾à¦ªà¦²à¦¿à¦•à§‡à¦¶à¦¨ গà§à¦²à§‹ লিসà§à¦Ÿà§‡ দেখাবে। আমি সà§à¦¬à¦¿à¦§à¦¾à¦° জনà§à¦¯ অনà§à¦¯ রিপোজিটরি গà§à¦²à§‹ মà§à¦›à§‡ দিয়েছিলাম ফলে লিসà§à¦Ÿà§‡ ইনসà§à¦Ÿà¦²à¦¡ à¦à§à¦¯à¦¾à¦ªà¦²à¦¿à¦•à§‡à¦¶à¦¨ à¦à¦¬à¦‚ সারà¦à¦¾à¦° সিডির à¦à§à¦¯à¦¾à¦ªà¦²à¦¿à¦•à§‡à¦¶à¦¨ গà§à¦²à§‹à¦‡ দেখতে পেয়েছি। ((তবে দরকার নাহলে à¦à¦Ÿà¦¾ আপনার করার পà§à¦°à§Ÿà§‹à¦œà¦¨ নেই))
বà§à¦¯à¦¾à¦¸
হà§à¦¯à¦¾à¦ªà¦¿ লিনাকà§à¦¸à¦¿à¦‚ লিনাকà§à¦¸à§‡ আগà§à¦°à¦¹à§€à¦¦à§‡à¦° জনà§à¦¯ বলছি। সাইকেল চালানো শেখার সময় যেমন পড়ে পড়ে শিখেছিলেন তেমনি সহজ লিনাকà§à¦¸ “উবà§à¦¨à§à¦Ÿà§” (সব অটোমেটিক আর সহজ যেমন হারà§à¦¡à¦¡à¦¿à¦¸à§à¦• মাউনà§à¦Ÿà¦¿à¦‚,deb file ঠকà§à¦²à¦¿à¦• করে পà§à¦¯à¦¾à¦•à§‡à¦œ ইনসà§à¦Ÿà¦² ইতà§à¦¯à¦¾à¦¦à¦¿)
বà§à¦¯à¦¬à¦¹à¦¾à¦° না করে জটিলটি আগে বà§à¦¯à¦¾à¦¬à¦¹à¦¾à¦° করà§à¦¨ । যেমন আমার পà§à¦°à¦¥à¦® বà§à¦¯à¦¬à¦¹à§ƒà¦¤ লিনাকà§à¦¸ হচà§à¦›à§‡ ফিডোরা কোর 4 à¦à¦Ÿà¦¿ বà§à¦¯à¦¬à¦¹à¦¾à¦°à§‡à¦° সময় নানান জায়গায় আটকেছি কিà¦à¦¾à¦¬à§‡ আমার হাডডিসà§à¦•à¦¡à§à¦°à¦¾à¦‡à¦ গà§à¦²à§‹ মাউনà§à¦Ÿ করতে হবে জানতাম না
আরপিà¦à¦® পà§à¦¯à¦•à§‡à¦œà¦—à§à¦²à§‹ কিà¦à¦¾à¦¬à§‡ টারমিনালে কমানà§à¦¡ দিয়ে ইনসà§à¦Ÿà¦² করতে হয় জানতাম না , সোরà§à¦¸à¦•à§‹à¦¡ কমà§à¦ªà¦¾à¦‡à¦² করে কিà¦à¦¾à¦¬à§‡ পà§à¦°à§‹à¦—à§à¦°à¦¾à¦® ইনসà§à¦Ÿà¦² করতে হয় জানতাম না। à¦à¦—à§à¦²à§‹ আসà§à¦¤à§‡ আসà§à¦¤à§‡ গবেষনা করতে করতে শিখেছি à¦à¦•à§à¦·à§‡à¦¤à§à¦°à§‡ সবচেয়েবেশী সহায়তা যেখানথেকে পেয়েছি তাহল বিডিলাগ থেকে
http://groups.yahoo.com/group/bdlug/
à¦à¦à¦¾à¦¬à§‡ শিখার ফলে à¦à¦–ন আমি উবà§à¦¨à§à¦Ÿà§ ইউজ করলেও পà§à¦°à§Ÿà§‹à¦œà¦¨à§€à§Ÿ অনেক কমানà§à¦¡ জানি সহজ কাজটা জটিল à¦à¦¾à¦¬à§‡ ও করতে জানি (Terminal) ঠ🙂
nice tutorial.. i agree abt xampp.. i also have some bad experience.. anyway i don’t like any third party package who make our life easier.. i can’t learn properly from that software.. how to configure or customize.. may be u all understand..
A great resource for every PHP developer. Great work lavluda. You are too good 🙂
Hay nice tutorial :), Go ahead……..
thanks tania, arild, hasin bhai, darkloard, morshid bhai, mizan bhia, deborah apu, zaher, babu, omi , sharif for your valuable comments. Your comments giving the energy to write more :).
Great! Any update about project 🙂
thanks mizan bhai, now i am thinking to write a total guide to setup your dedicated server with debian / ubuntu linux 🙂
No problem, ami achi 🙂
মà§à¦à§‡à¦¬à¦²à¦Ÿà¦¾à¦‡à¦ª টà§à¦°à¦¾à¦‡ করসেন?
4th à¦à¦¾à¦¸à¦°à§à¦¨ ফà§à¦°à¦¿ à¦à¦¬à¦‚ ওপেনসোরà§à¦¸
http://www.movabletype.org/
http://www.movabletype.org/screenshots/
Thank you for sharing!
Thanks for a great tutorial. Everything worked first time except moving database. After moving mysql db folders in phpmyadmin I can see a list of moved databases with correct number of tables next to them, but when I click on one of them they show as empty (no tables). Any suggestions?
Thanks for a great tutorial. Everything worked first time, except moving mysql databases. I moved db folders and changed permissions. When I go to phpmyadmin it shows transfered databases and correct number of tables next to them, but when I click on one of them, it says database empty (no tables) any ideas?
hi arnold,
i just found the reson, i missed 1 command in mysql section.
after
“chown -R mysql:mysql /var/lib/mysql/xyz”
you have to run:
“chmod 700 -R /var/lib/mysql/xyz”
please reply if you still getting problem.
After posting here I decided to transfer my old data to another windows system, created temporary wamp server there and exported all databases using phpmyadmin.
Anyway, thanks for your reply. Release of Hardy Heron and your post about moving development environment made me make up my mind and finally switch to Linux. I finally have Zend for Eclipse up and running and working on my projects again.
Woh I like your posts , saved to fav! . 166659
It’s perfect time to make some plans for the future and it’s time to be happy.
I have read this post and if I could I desire to suggest you few interesting things or suggestions.
Perhaps you could write next articles referring to this article.
I wish to read more things about it!