How to install XAMPP and PhpStorm on Fedora 17 (64 bit)

XAMPP is a cross-platform PHP web-app development stack for Windows, Linux, Apple Mac OS X and Solaris.

PhpStorm is a commercial cross-platform IDE for developing PHP web applications.

Tested With
 * Fedora 17
 * PhpStorm 4.0.2
 * xampp-linux-1.7.7.tar.gz (PHP 5.3)

Install Oracle JRE 7 (1.7)
PhpStorm warns of stability problems when run under OpenJDK instead of Oracle JRE/JDK, and is reportedly significantly faster running on JRE/JDK 7 than JRE/JDK 6. Recents reports suggest satisfactory performance on OpenJDK, but official requirement is still Oracle JRE.


 * Download the Java SE 7 JRE (Java Runtime Environment) RPM from Oracle
 * Install Java SE 7 JRE


 * 1) su -
 * 2) rpm -Uvh /path/to/jre-7u5-linux-x64.rpm

If using 32-bit Fedora 17, install the 32-bit JRE (i.e. jre-7u5-linux-i586.rpm).

Install PhpStorm

 * Download PhpStorm from JetBrains (e.g. PhpStorm-4.0.2.tar.gz)
 * Login as root and unpack the PhpStorm .tar.gz file to /opt


 * 1) tar xvfz PhpStorm-4.0.2.tar.gz -C /opt


 * Edit your user ~/.bashrc and add the following lines to define JDK_HOME so PhpStorm can find Java SE JRE 7, and to add an alias for running PhpStorm (using nohup frees the terminal window for other use, but also is a safety measure to prevent PhpStorm from being killed if the terminal window is closed).

JDK_HOME=/usr/lib64/jvm/jre-sun export JDK_HOME alias phpstorm='nohup /opt/PhpStorm-117.501/bin/phpstorm.sh &'
 * 1) PhpStorm
 * 2) set path to Java SE JRE 7
 * 1) set alias for starting PhpStorm

The 32-bit JRE path (installing jre-7u5-linux-i586.rpm) was JDK_HOME=/usr/lib/jvm/jre


 * Reload your bash environment

> . ./.bashrc

Install XAMPP

 * Download the latest XAMPP for Linux release from Apache Friends (if you prefer a beta release, they are not obviously linked on the XAMPP website, see the Apache Friends XAMPP BETA page or the XAMPP SourceForge project Files page under BETAS).


 * Login as root and extract the downloaded archive file to /opt:


 * 1) tar xvzf xampp-linux-1.7.7.tar.gz -C /opt


 * Install 32-bit compatibility libraries

> sudo yum install glibc.i686 libgcc.i686 libstdc++.i686

Not required with 32-bit Fedora


 * Edit the LAMPP script file /opt/lampp/lampp and comment out the 32-bit check


 * 1) XAMPP is currently 32 bit only
 * 2) case `uname -m` in
 * 3)    *_64)
 * 4)    if /opt/lampp/bin/php -v &gt; /dev/null 2&gt;&amp;1
 * 5)        then
 * 6)    else
 * 7)        $de &amp;&amp; echo "XAMPP gibt es zur Zeit nur als 32-Bit Applikation. Bitte verwende eine 32-Bit Ko$
 * 8)        $de || echo "XAMPP is currently only availably as 32 bit application. Please use a 32 bit com$
 * 9)        exit
 * 10)    fi
 * 11) esac
 * 1) esac
 * 1) esac

Not required with 32-bit Fedora


 * XAMPP/LAMPP has been reportedly compiled with the executable stack enabled. Starting at Fedora 12, the default SELinux policy denies the executable stack to be enabled, preventing older versions of XAMPP/LAMPP from running. The XAMPP/LAMPP startup script (/opt/lampp/lampp) now include a hack to accomodate SELinux, but if there are errors starting xampp (e.g., "Error 127 Couldn't start Apache!"), you can change the SELinux policy to enable the executable stack (be aware this will enables it for ALL libs though).


 * 1) setsebool -P allow_execstack on


 * Of course, there are other reasons for "Error 127 Couldn't start Apache!". In my case, /etc/hosts didn't include a hostname, but the lampp script kindy added it for me.


 * Set the permissions on /opt/lampp/htdocs/ so that everyone (e.g., you and the Apache web server) has write permission to htdocs/

It would arguably be more secure to create a new group, add the web server user and your userid to the group, change the group owner of htdocs/ to the new group, and finally add group write permission to htdocs/ - but that would also be a lot more complicated and there is minimal risk on a development workstation.


 * 1) chmod -R 777 /opt/lampp/htdocs/

Install XDebug
The XDebug project doesn't distribute binaries for Linux systems. Typical instructions to install XDebug will compile XDebug from source. However, on 64-bit Fedora system XDebug will be compiled as a 64-bit binary, which will conflict with the 32-bit XAMPP/LAMPP. In this case, the simplest solution is to use a pre-compiled 32-bit XDebug from Active State (which may also be simplest solution on 32-bit Fedora).


 * Download the Linux 32-bit PHP Remote Debugging Package from Active State (e.g. Komodo-PHPRemoteDebugging-7.0.2-70257-linux-x86.tar.gz). The package includes compiled 32-bit xdebug.so files for recent PHP releases.


 * Extract the contents of the tar file and copy the appropriate xdebug.so (e.g. 5.4/xdebug.so) file to /opt/lampp/lib/php/extensions/xdebug.so


 * Edit php.ini and add an [Xdebug] section with the following lines (xdebug.manual_url can also be set if desired to your closest mirror, e.g. xdebug.manual_url = "http://ca.php.net" ).

[Xdebug] zend_extension="/opt/lampp/lib/php/extensions/xdebug.so" xdebug.remote_enable = 1

Start XAMPP

 * Start XAMPP from command shell (must be root)


 * 1) /opt/lampp/lampp start

or start XAMPP control panel


 * 1) /opt/lampp/lampp panel

Check phpinfo from the local XAMPP home page and confirm xdebug is enabled.

Configure PhpStorm with XDebug

 * Run PhpStorm and open a project for debugging
 * Click the ''PHP Listen debug connections'’ button.
 * Follow the JetBrains blog post Zero-configuration debugging with XDebug and PhpStorm 2.0