As a PHP developer on Ubuntu, we may need to re setup our development environment sometimes. I did it already a few times, so decided to write down the steps for a typical php development environment on ubuntu. My Ubuntu version is 16.04.
We need to enable PPA in order to install PHP 5.6.
sudo add-apt-repository ppa:ondrej/php
Now we can install PHP 5.6 by the following commands
sudo apt-get update
sudo apt-get install php5.6 php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml php5.6-intl php5.6-intl php5.6-mbstring php5.6-cli php5.6-gd php5.6-curl php5.6-sqlite3
sudo apt-get install apache2
sudo a2enmod rewrite
sudo apt-get install libapache2-mod-php5.6
Ubuntu 16.04 comes with PHP 7 as default. If you have PHP 7 installed, it won’t activate php 5.6 module. To activate, run
a2dismod php7.0
a2enmod php5.6
Now finally restart apache, so you are done with PHP 5.6 installation.
service apache2 restart
sudo apt-get install mysql-server
sudo apt-get install php5-mysql
Please follow the instruction from the link bellow to install PHPMyAdmin in your system.
https://www.ostechnix.com/install-phpmyadmin-with-lamp-stack-on-ubuntu-16-04/
sudo apt-get install curl
You need to first install Oracle JDK in order to install PHP Storm. If you want to use SmartGIT 17.1.2 in your system then install JDK 8, otherwise you can install latest JDK 9.
First, update the package index.
sudo apt-get update
Then, add Oracle's PPA, then update your package repository.
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
To install JDK 8, use the following command:
sudo apt-get install oracle-java8-installer
During the installation process you will need to accept the Oracle License agreement. Once installed we need to set Java environment variables such as JAVA_HOME on Ubuntu 16.04/17.04.
sudo apt-get install oracle-java8-set-default
source /etc/profile
You can check the configured JAVA_HOME value by running the command bellow.
echo $JAVA_HOME
First go the official website and download the tar archive. Extract the archive in your system and you will get a folder like ‘PhpStorm-172.4155.41’ (latest version at the time of writing this). Then go to the location where you downloaded it from the command line and move the folder to /opt/phpstorm following the command below.
sudo mv PhpStorm-172.4155.41/ /opt/phpstorm/
Create a symlink
sudo ln -s /opt/phpstorm/bin/phpstorm.sh /usr/local/bin/phpstorm
Now type phpstorm in the terminal to launch the application.
phpstorm
Follow the installation instruction of Importing from previous installation and Privacy Policy. Then choose the ‘Evaluate for fee for 30 days’ option and complete the installation.
After installation, opent the IDE and activate the license.
Go to Help > Register
Choose the 'License Server' option and use this URL as the license server, http://idea.imsxm.com
Click Activate, and you are done! :)
Check if Composer is already instaled or not.
composer
Before installing the composer, we need to update the machine with the below command –
sudo apt-get update
Composer will be installed under /usr/local/bin
Download the Composer using the below command in the /tmp folder
sudo php -r "copy('https://getcomposer.org/installer', '/tmp/composer-setup.php');"
Once you have downloaded the script, we will install the packages using the below command, and will install the Composer in the /usr/local/bin with –install-dir flag;
sudo php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer
Finally check the version of the composer to make sure it is installed properly.
composer --version
- Assuming that you have already installed php and apache
- Install xDebug php extension
# Ubuntu 16.04,18.04 php 7.x
sudo apt-get install php-xdebug
# Ubuntu 14.04, php 5.6
sudo apt-get install php5-xdebug
- Edit your
xdebug.ini
- Your
xdebug.ini
file path should look like this/etc/php/7.1/mods-available/xdebug.ini
- Add these lines without modifying exiting
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.idekey = PHPSTORM
xdebug.show_error_trace = 1
xdebug.remote_autostart = 0
xdebug.file_link_format = phpstorm://open?%f:%l
- Restart the apache server to reflect changes
sudo service apache2 restart
-
Configure phpStorm
-
Go through - Settings >> Languages & Frameworks >> PHP >> Debug
-
Check that 'Debug port' is the same you have in your
xdebug.ini
. In our case it was9000
. -
Save and close the Settings Dialog
-
Start debugging
-
Create some breakpoints in your project
-
Make sure those breakpoints gets executed when your visit your website in browser.
-
Start listener by clicking on the telephone 📞 button on top toolbar
-
If you can't find telephone button; then go through menus - Run -> Start listening for PHP Debug Connections
-
In your browser access your project url like this
http://localdomain.test/?XDEBUG_SESSION_START=1
-
OR use bookmarks
-
OR use chrome extension
-
You should see a popup window in PhpStorm , click Accept connection
-
Done, enjoy debugging !!!
sudo phpdismod xdebug
sudo phpenmod xdebug
sudo phpdismod -s cli xdebug
Step 1 – Download Skype Debian Package
First of all, download the Skype package for Debian system from its official download page. You can also use below command to download latest available Debian package.
wget https://repo.skype.com/latest/skypeforlinux-64.deb
Step 2 – Install Skype
Use the following command to install downloaded skype package on your Ubuntu system.
sudo dpkg -i skypeforlinux-64.deb
In the case of the above command failed to install package due to any dependency run command.
sudo apt-get install -f
Step 3 – Launch Skype
Use your dashboard skype button to start skype on your system, or you can use the following command as well.
skypeforlinux
Thanks for posting this! This was very useful for getting a debug setup for PHPstorm 5.6 working without major headaches! Only minimal changes doing similar on Ubuntu 20.04 which is mostly omitting steps.