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.
- 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
# su - # 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).
- Download PhpStorm from JetBrains (e.g. PhpStorm-4.0.2.tar.gz)
- Login as root and unpack the PhpStorm .tar.gz file to /opt
# 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).
# PhpStorm # set path to Java SE JRE 7 JDK_HOME=/usr/lib64/jvm/jre-sun export JDK_HOME # set alias for starting PhpStorm alias phpstorm='nohup /opt/PhpStorm-117.501/bin/phpstorm.sh &'
The 32-bit JRE path (installing jre-7u5-linux-i586.rpm) was JDK_HOME=/usr/lib/jvm/jre
- Reload your bash environment
> . ./.bashrc
- 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:
# 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
# XAMPP is currently 32 bit only #case `uname -m` in # *_64) # if /opt/lampp/bin/php -v > /dev/null 2>&1 # then # : # else # $de && echo "XAMPP gibt es zur Zeit nur als 32-Bit Applikation. Bitte verwende eine 32-Bit Ko$ # $de || echo "XAMPP is currently only availably as 32 bit application. Please use a 32 bit com$ # exit # fi # ;; #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).
# 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.
# chmod -R 777 /opt/lampp/htdocs/
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 from command shell (must be root)
# /opt/lampp/lampp start
or start XAMPP control panel
# /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
- Oracle/Sun JDK