Install Apache2 with PHP5


/ Published in: Other
Save to your folder(s)

This takes about an hour in total to run on my machine, so give yourself enough time. Obviously the configure options will need to be tweaked to match your set up, but this works for me. This assumes you already have MySQL installed.


Copy this code and paste it in your HTML
  1. # 1. install Apache, it doesn't have to go in the /opt directory
  2. # (change the URL to be whatever the latest release is)
  3. wget http://apache.rmplc.co.uk/httpd/httpd-2.2.6.tar.gz
  4. tar -xvzf httpd-2.2.6.tar.gz
  5. cd httpd-2.2.6
  6. ./configure \
  7. --prefix=/opt/apache2.2.6/ \
  8. --enable-so \
  9. --enable-cgi \
  10. --enable-info \
  11. --enable-rewrite \
  12. --enable-usertrack \
  13. --enable-deflate \
  14. --enable-ssl \
  15. --enable-mime-magic
  16. make
  17. sudo make install
  18.  
  19. # 2. install PHP, change the paths to match your machine
  20. wget http://ftp.at.linuxfromscratch.org/pub/php/php-5.2.4.tar.gz
  21. tar -xvzf php-5.2.4.tar.gz
  22. cd php-5.2.4
  23. ./configure \
  24. --with-apxs2=/opt/apache2.2.6/bin/apxs \
  25. --with-zlib=/usr \
  26. --with-mysql=/usr/local/mysql \
  27. --with-pgsql=/usr/local/pgsql \
  28. --prefix=/opt/apache2.2.6/php \
  29. --with-config-file-path=/opt/apache2.2.6/php \
  30. --enable-force-cgi-redirect \
  31. --enable-shared \
  32. --disable-cgi
  33. make
  34. sudo make install
  35.  
  36. # 3. enable PHP on your new server, adjust other configs as needed
  37. sudo vi /opt/apache2.2.6/conf/httpd.conf
  38. AddType application/x-httpd-php .php
  39. AddType application/x-httpd-php-source .phps
  40. DirectoryIndex index.html index.php
  41.  
  42. # 4. start the MySQL server if you need to
  43. sudo mysqld_safe &
  44.  
  45. # 5. start the new server (use start, restart or stop as required)
  46. sudo /opt/apache2.2.6/bin/apachectl start

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.