Skip to content

Instantly share code, notes, and snippets.

@linkanp
Last active October 24, 2022 19:10
Show Gist options
  • Save linkanp/21bafdc037a9429ea76743d880788469 to your computer and use it in GitHub Desktop.
Save linkanp/21bafdc037a9429ea76743d880788469 to your computer and use it in GitHub Desktop.

Revisions

  1. linkanp revised this gist Oct 1, 2018. 1 changed file with 25 additions and 0 deletions.
    25 changes: 25 additions & 0 deletions php_environment_setup_ubuntu.md
    Original file line number Diff line number Diff line change
    @@ -208,3 +208,28 @@ 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



  2. linkanp revised this gist Sep 6, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion php_environment_setup_ubuntu.md
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ As a PHP developer on Ubuntu, we may need to re setup our development environmen
    * [Oracle JDK 8](#jdk8)
    * [PHPStorm IDE](#phpstorm)
    * [Composer](#composer)
    * [XDebug] (#xdebug)
    * [XDebug](#xdebug)

    ## Installation PHP 5.6 & Apache2
    <a name="php"></a>
  3. linkanp revised this gist Sep 6, 2018. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion php_environment_setup_ubuntu.md
    Original file line number Diff line number Diff line change
    @@ -10,6 +10,7 @@ As a PHP developer on Ubuntu, we may need to re setup our development environmen
    * [Oracle JDK 8](#jdk8)
    * [PHPStorm IDE](#phpstorm)
    * [Composer](#composer)
    * [XDebug] (#xdebug)

    ## Installation PHP 5.6 & Apache2
    <a name="php"></a>
    @@ -143,7 +144,7 @@ Finally check the version of the composer to make sure it is installed properly.
    ```shell
    composer --version
    ```

    <a name="xdebug"></a>
    ## Install and Configure xDebug on Ubuntu for PhpStorm

    * Assuming that you have already installed php and apache
  4. linkanp revised this gist Sep 6, 2018. 1 changed file with 64 additions and 0 deletions.
    64 changes: 64 additions & 0 deletions php_environment_setup_ubuntu.md
    Original file line number Diff line number Diff line change
    @@ -143,3 +143,67 @@ Finally check the version of the composer to make sure it is installed properly.
    ```shell
    composer --version
    ```

    ## Install and Configure xDebug on Ubuntu for PhpStorm

    * Assuming that you have already installed php and apache
    * **Install [xDebug](https://xdebug.org/docs/install) 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 was `9000`.
    * Save and close the Settings Dialog

    * **Start debugging**
    * Create some [breakpoints](https://www.jetbrains.com/help/phpstorm/breakpoints-2.html) in your project
    * Make sure those breakpoints gets executed when your visit your website in browser.
    * Start listener by clicking on the telephone :telephone_receiver: 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](https://www.jetbrains.com/phpstorm/marklets/)
    * OR use [chrome extension](https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc?hl=en)

    * You should see a popup window in PhpStorm , click **Accept** connection
    * Done, enjoy debugging !!!

    -----

    ### Disable xdebug
    ```
    sudo phpdismod xdebug
    ```
    ### Enable xdebug back
    ```
    sudo phpenmod xdebug
    ```
    ### Disable xdebug for commandline only
    ```
    sudo phpdismod -s cli xdebug
    ```
  5. linkanp revised this gist Feb 9, 2018. 1 changed file with 26 additions and 0 deletions.
    26 changes: 26 additions & 0 deletions php_environment_setup_ubuntu.md
    Original file line number Diff line number Diff line change
    @@ -9,6 +9,7 @@ As a PHP developer on Ubuntu, we may need to re setup our development environmen
    * [CURL](#curl)
    * [Oracle JDK 8](#jdk8)
    * [PHPStorm IDE](#phpstorm)
    * [Composer](#composer)

    ## Installation PHP 5.6 & Apache2
    <a name="php"></a>
    @@ -117,3 +118,28 @@ 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! :)

    <a name="composer"></a>
    ### Install Composer
    Check if Composer is already instaled or not.
    ```shell
    composer
    ```
    Before installing the composer, we need to update the machine with the below command –
    ```shell
    sudo apt-get update
    ```
    Composer will be installed under /usr/local/bin

    Download the Composer using the below command in the /tmp folder
    ```shell
    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;
    ```shell
    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.
    ```shell
    composer --version
    ```
  6. linkanp revised this gist Nov 20, 2017. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions php_environment_setup_ubuntu.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,5 @@
    # PHP 5.6 Development Environment on Ubuntu 16.04
    If you're a php developer on ubuntu, there comes the time where you have to install/reinstall your system.
    I did it already a few times and i decided to write down the steps for a typical web developer stack with php.
    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.

    ## Installation List
    * [PHP 5.6](#php)
  7. linkanp created this gist Nov 20, 2017.
    120 changes: 120 additions & 0 deletions php_environment_setup_ubuntu.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,120 @@
    # PHP 5.6 Development Environment on Ubuntu 16.04
    If you're a php developer on ubuntu, there comes the time where you have to install/reinstall your system.
    I did it already a few times and i decided to write down the steps for a typical web developer stack with php.

    ## Installation List
    * [PHP 5.6](#php)
    * [Apache2](#apache2)
    * [MySQL](#mysql)
    * [PHPMyAdmin](#phpmyadmin)
    * [CURL](#curl)
    * [Oracle JDK 8](#jdk8)
    * [PHPStorm IDE](#phpstorm)

    ## Installation PHP 5.6 & Apache2
    <a name="php"></a>
    We need to enable PPA in order to install PHP 5.6.
    ```shell
    sudo add-apt-repository ppa:ondrej/php
    ```
    Now we can install PHP 5.6 by the following commands
    ```shell
    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
    ```
    <a name="apache2"></a>
    To install <b>Apache2</b>, run
    ```shell
    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
    ```shell
    a2dismod php7.0
    a2enmod php5.6
    ```

    Now finally restart apache, so you are done with PHP 5.6 installation.
    ```shell
    service apache2 restart
    ```

    <a name="mysql"></a>
    ## MySQl
    ```shell
    sudo apt-get install mysql-server
    sudo apt-get install php5-mysql
    ```

    <a name="phpmyadmin"></a>
    ## PHPMyAdmin
    Please follow the instruction from the link bellow to install PHPMyAdmin in your system.
    ```html
    https://www.ostechnix.com/install-phpmyadmin-with-lamp-stack-on-ubuntu-16-04/
    ```

    <a name="curl"></a>
    ## CURL
    ```shell
    sudo apt-get install curl
    ```

    <a name="phpstorm"></a>
    ## PHP Storm IDE
    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.

    <a name="jdk8"></a>
    ### Install Oracle JDK 8

    First, update the package index.
    ```shell
    sudo apt-get update
    ```

    Then, add Oracle's PPA, then update your package repository.
    ```shell
    sudo add-apt-repository ppa:webupd8team/java
    sudo apt-get update
    ```

    To install JDK 8, use the following command:
    ```shell
    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.
    ```shell
    sudo apt-get install oracle-java8-set-default
    source /etc/profile
    ```
    You can check the configured JAVA_HOME value by running the command bellow.
    ```shell
    echo $JAVA_HOME
    ```
    ### Install PHP Storm

    First go the [official website](https://www.jetbrains.com/phpstorm/download/#section=linux) 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.
    ```shell
    sudo mv PhpStorm-172.4155.41/ /opt/phpstorm/
    ```

    Create a symlink
    ```shell
    sudo ln -s /opt/phpstorm/bin/phpstorm.sh /usr/local/bin/phpstorm
    ```
    Now type phpstorm in the terminal to launch the application.
    ```shell
    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! :)