{"id":116,"date":"2010-02-17T10:35:38","date_gmt":"2010-02-17T09:35:38","guid":{"rendered":"https:\/\/www.opengis.ch\/?p=116"},"modified":"2020-04-29T16:08:00","modified_gmt":"2020-04-29T14:08:00","slug":"custom-php-5-3-1-with-apc-and-xdebug-on-dreamhost-shared-hosting","status":"publish","type":"post","link":"https:\/\/www.opengis.ch\/fr\/2010\/02\/17\/custom-php-5-3-1-with-apc-and-xdebug-on-dreamhost-shared-hosting\/","title":{"rendered":"Custom PHP 5.3.1 with APC and XDEBUG on (Dreamhost) Shared Host"},"content":{"rendered":"<p>I&rsquo;ve recently been setting up my new dreamhost for symfony projects deployment and the only thing the default PHP is missing is the support for APC (alternate php cache). <!--more-->So after looking at the <a href=\"https:\/\/wiki.dreamhost.com\/index.php\/Installing_PHP5\">dreamhost wiki<\/a> I cleaned up and added some features to the <a href=\"https:\/\/wiki.dreamhost.com\/index.php\/Installing_PHP5#Improved_script_for_a_minimal_PHP_5.3.x_install_with_APC\">one of the install scripts<\/a>. Here it is for your\/mine (future) commodity.<\/p>\n<pre lang='BASH' line='1'>\n#!\/bin\/sh\n# update 16.2.2010\n# @author Marco Bernasocchi <marco@bernawebdesign.ch>\n# - Added OPENSSL LIBMCRYPT LIBTOOL and a promt for installing XDEBUG\n#   (still uses XDEBUG 2.05, which has basic PHP 5.3.1 support. 2.1.0 is on its way)\n# - removed unsupported php configure switches\n# - disabled --with-xsl, if you want to use it you'll probably need to install\n#   libxslt (https:\/\/xmlsoft.org\/XSLT\/) version 1.1.0 or greater.\n# - sets the ini files into the install directory instead than on cgi-bin\n# - to add more domains just copy the cgi binary to the new domain\n#   cp \"$PHP_BIN_DIR\/php-cgi\" \"$NEW_CGI_BIN_DIR\/php.cgi\" and modifiy the .htaccess\n#Script for a minimal PHP 5.3.x install with APC\n#\n#- Prompts for the domain to build for\n#- PHP configure line contains only valid PHP5 options\n#- Displays colourful status messages\n#- Many build messages, which aren't helpful to most people, are now suppressed\n#- Procedurised, making it cleaner and easier to follow\n#\n#The only things you may want to change in here are marked with \"@todo\"s\n#\n#Derived form the original PHP 5.3 install script at\n#https:\/\/wiki.dreamhost.com\/Installing_PHP5\n#\n#@author Dan Bettles <dan@danbettles.net>\n#Exit on error\nset -e\nclear\necho -n \"Enter the domain for which you want to build PHP and press [ENTER]: \"\nread DOMAIN\necho -n \"Enable XDEBUG (y|n): \"\nread ENABLEXDEBUG\n#===============================================================================\n#@todo Update versions, if necessary\nM4=\"m4-1.4.13\"\nAUTOCONF=\"autoconf-2.65\"\nOPENSSL=\"openssl-0.9.8l\"\nCURL=\"curl-7.20.0\"\nLIBMCRYPT=\"libmcrypt-2.5.8\"\nLIBTOOL=\"libtool-2.2.6b\"\nPHP=\"php-5.3.1\"\nAPC=\"APC-3.1.3p1\"\nXDEBUG=\"xdebug-2.0.5\"\n#@todo Update install paths, if necessary\nWEB_ROOT=\"$HOME\/$DOMAIN\/web\"\nCGI_BIN_DIR=\"$WEB_ROOT\/cgi-bin\"\nHTACCESS=\"$WEB_ROOT\/.htaccess\"\nINSTALL_DIR=\"$HOME\/mycompiles\"\nBUILD_DIR=\"$INSTALL_DIR\/build\"\nDOWNLOADS_DIR=\"$INSTALL_DIR\/downloads\"\nPHP_BASE_DIR=\"$INSTALL_DIR\/$PHP\"\nPHP_BIN_DIR=\"$PHP_BASE_DIR\/bin\"\nPHP_EXTENSIONS_DIR=\"$PHP_BASE_DIR\/extensions\"\nPHP_CONFIG_DIR=\"$PHP_BASE_DIR\/etc\/php5\/config\"\nPHP_INI=\"$PHP_CONFIG_DIR\/php.ini\"\n#@todo Alter features, if necessary\nPHP_FEATURES=\"--prefix=$PHP_BASE_DIR\n --with-config-file-path=$PHP_CONFIG_DIR\n --with-config-file-scan-dir=$PHP_CONFIG_DIR\n --bindir=$PHP_BIN_DIR\n --enable-zip\n --with-xmlrpc\n --with-freetype-dir=\/usr\n --with-zlib-dir=\/usr\n --with-jpeg-dir=\/usr\n --with-png-dir=\/usr\n --with-curl=$PHP_BASE_DIR\n --with-gd\n --enable-gd-native-ttf\n --enable-ftp\n --enable-exif\n --enable-sockets\n --enable-wddx\n --enable-sqlite-utf8\n --enable-calendar\n --enable-mbstring\n --enable-mbregex\n --enable-bcmath\n --with-mysql=\/usr\n --with-mysqli\n --without-pear\n --with-gettext\n --with-pdo-mysql\n --with-openssl=$PHP_BASE_DIR\n #--with-xsl=$=$PHP_BASE_DIR\n --with-mcrypt=$PHP_BASE_DIR\"\n#===============================================================================\n#@param string $1 Message\nfunction echoL1 () {\n    echo -e \"n\u000033[1;37;44m$1\u000033[0;0;0mn\"\n}\n#@param string $1 Message\nfunction echoL2 () {\n    echo -e \"n\u000033[0;37;44m$1\u000033[0;0;0mn\"\n}\n#@param string $1 URL\n#@param string $2 Output directory\nfunction downloadTo () {\n    wget -c $1 --directory-prefix=$2\n}\n#@param string $1 TAR filename\n#@param string $2 Output directory\nfunction untarTo () {\n    cd $2\n    tar -xzf $1\n    cd -\n}\n#@param string $1 Source directory\n#@param string $2 Output directory\n#@param string $3 configure arguments\nfunction configureAndMake () {\n    cd $1\n    COMMAND=\".\/configure --quiet --prefix=$2 $3\"\n    if [ $1 = \"$BUILD_DIR\/$OPENSSL\" ];then\n      #special command for OPEN SSL\n      COMMAND=\".\/config --prefix=$2 $3\"\n    fi\n    echo \"$COMMAND\"\n    eval $COMMAND\n    make --quiet\n    cd -\n}\n#@param string $1 Source directory\n#@param string $2 Output directory\n#@param string $3 configure arguments\nfunction makeAndInstall () {\n    configureAndMake $1 $2 \"$3\"\n    cd $1\n    make install --quiet\n    cd -\n}\n#@param string $1 Directory\nfunction mkdirClean () {\n    rm -rf $1\n    mkdir -p $1\n}\n#@param string $1 Message\nfunction echoWarning () {\n    echo -e \"n\u000033[1;37;41m$1\u000033[0;0;0mn\"\n}\n#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nexport PATH=\"$PATH:$PHP_BIN_DIR\"\nechoL1 \"-> DOWNLOADING...\"\nmkdirClean $BUILD_DIR\nechoL2 \"--> Downloading $M4...\"\ndownloadTo \"https:\/\/ftp.gnu.org\/gnu\/m4\/$M4.tar.gz\" $DOWNLOADS_DIR\nuntarTo \"$DOWNLOADS_DIR\/$M4.tar.gz\" $BUILD_DIR\nechoL2 \"--> Downloading $AUTOCONF...\"\ndownloadTo \"https:\/\/ftp.gnu.org\/gnu\/autoconf\/$AUTOCONF.tar.gz\" $DOWNLOADS_DIR\nuntarTo \"$DOWNLOADS_DIR\/$AUTOCONF.tar.gz\" $BUILD_DIR\nechoL2 \"--> Downloading $OPENSSL...\"\ndownloadTo \"https:\/\/www.openssl.org\/source\/$OPENSSL.tar.gz\" $DOWNLOADS_DIR\nuntarTo \"$DOWNLOADS_DIR\/$OPENSSL.tar.gz\" $BUILD_DIR\nechoL2 \"--> Downloading $CURL...\"\ndownloadTo \"https:\/\/curl.haxx.se\/download\/$CURL.tar.gz\" $DOWNLOADS_DIR\nuntarTo \"$DOWNLOADS_DIR\/$CURL.tar.gz\" $BUILD_DIR\nechoL2 \"--> Downloading $LIBMCRYPT...\"\ndownloadTo \"https:\/\/easynews.dl.sourceforge.net\/sourceforge\/mcrypt\/$LIBMCRYPT.tar.gz\" $DOWNLOADS_DIR\nuntarTo \"$DOWNLOADS_DIR\/$LIBMCRYPT.tar.gz\" $BUILD_DIR\nechoL2 \"--> Downloading $LIBTOOL...\"\ndownloadTo \"https:\/\/ftp.gnu.org\/gnu\/libtool\/$LIBTOOL.tar.gz\" $DOWNLOADS_DIR\nuntarTo \"$DOWNLOADS_DIR\/$LIBTOOL.tar.gz\" $BUILD_DIR\nechoL2 \"--> Downloading $PHP...\"\ndownloadTo \"https:\/\/www.php.net\/get\/$PHP.tar.gz\/from\/this\/mirror\" $DOWNLOADS_DIR\nuntarTo \"$DOWNLOADS_DIR\/$PHP.tar.gz\" $BUILD_DIR\nechoL2 \"--> Downloading $APC...\"\ndownloadTo \"https:\/\/pecl.php.net\/get\/$APC.tgz\" $DOWNLOADS_DIR\nuntarTo \"$DOWNLOADS_DIR\/$APC.tgz\" $BUILD_DIR\nif [ $ENABLEXDEBUG = \"y\" ]; then\n  echoL2 \"--> Downloading $XDEBUG...\"\n  downloadTo \"https:\/\/xdebug.org\/files\/$XDEBUG.tgz\" $DOWNLOADS_DIR\n  untarTo \"$DOWNLOADS_DIR\/$XDEBUG.tgz\" $BUILD_DIR\nfi\n#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nechoL1 \"-> BUILDING...\"\nmkdir -p $PHP_BASE_DIR\nechoL2 \"--> Building $M4...\"\nmakeAndInstall \"$BUILD_DIR\/$M4\" $PHP_BASE_DIR\nechoL2 \"--> Building $AUTOCONF...\"\nmakeAndInstall \"$BUILD_DIR\/$AUTOCONF\" $PHP_BASE_DIR\nechoL2 \"--> Building $OPENSSL...\"\nmakeAndInstall \"$BUILD_DIR\/$OPENSSL\" $PHP_BASE_DIR\nechoL2 \"--> Building $CURL...\"\nmakeAndInstall \"$BUILD_DIR\/$CURL\" $PHP_BASE_DIR \"--enable-ipv6 --enable-cookies\n --enable-crypto-auth --with-ssl\"\nechoL2 \"--> Building $LIBMCRYPT...\"\nmakeAndInstall \"$BUILD_DIR\/$LIBMCRYPT\" $PHP_BASE_DIR \"--disable-posix-threads\"\nechoL2 \"--> Building $LIBTOOL...\"\nmakeAndInstall \"$BUILD_DIR\/$LIBTOOL\" $PHP_BASE_DIR\nechoL2 \"--> Building $PHP...\"\n#Fixes compile error\nexport EXTRA_LIBS=\"-lresolv\"\nmakeAndInstall \"$BUILD_DIR\/$PHP\" $PHP_BASE_DIR \"$PHP_FEATURES\"\n#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nechoL1 \"-> INSTALLING PHP...\"\nmkdir -p -m 0755 $CGI_BIN_DIR\nmkdir -p -m 0755 $PHP_CONFIG_DIR\ncp \"$PHP_BIN_DIR\/php-cgi\" \"$CGI_BIN_DIR\/php.cgi\"\ncp \"$BUILD_DIR\/$PHP\/php.ini-production\" $PHP_INI\nmkdir -p $PHP_EXTENSIONS_DIR\nechoL2 \"--> Building $APC...\"\nAPC_SOURCE_DIR=\"$BUILD_DIR\/$APC\"\ncd $APC_SOURCE_DIR\n$PHP_BIN_DIR\/phpize\nconfigureAndMake $APC_SOURCE_DIR $PHP_BASE_DIR \"--enable-apc --enable-apc-mmap\n --with-php-config=$PHP_BIN_DIR\/php-config\"\ncp modules\/apc.so $PHP_EXTENSIONS_DIR\necho \"extension=$PHP_EXTENSIONS_DIR\/apc.so\" > $PHP_CONFIG_DIR\/apc.ini\ncd -\nif [ $ENABLEXDEBUG = \"y\" ]; then\n  echoL2 \"--> Building $XDEBUG...\"\n  XDEBUG_SOURCE_DIR=\"$BUILD_DIR\/$XDEBUG\"\n  cd $XDEBUG_SOURCE_DIR\n  $PHP_BIN_DIR\/phpize\n  configureAndMake $XDEBUG_SOURCE_DIR $PHP_BASE_DIR \"--enable-xdebug\n   --with-php-config=$PHP_BIN_DIR\/php-config\"\n  cp modules\/xdebug.so $PHP_EXTENSIONS_DIR\n  echo \"zend_extension=$PHP_EXTENSIONS_DIR\/xdebug.so\" > $PHP_CONFIG_DIR\/xdebug.ini\n  cd -\nfi\n#-------------------------------------------------------------------------------\nif [ -f $HTACCESS ]; then\n    HTACCESS_NEW=\"$HTACCESS.old\"\n    cp $HTACCESS $HTACCESS_NEW\n    echoWarning \"--> Copied $HTACCESS to $HTACCESS_NEW\"\nfi\n#The backslash prevents a newline being inserted at the start\nHTACCESS_CONTENT=\"\nOptions +ExecCGI\nAddHandler php-cgi .php\nAction php-cgi \/cgi-bin\/php.cgi\n#Deny access to the PHP CGI executable and config files\n<filesMatch \"^php5?.(cgi|ini)$\">\n    Order Deny,Allow\n    Deny from All\n    Allow from env=REDIRECT_STATUS\n<\/filesMatch>\"\n#Preserve newlines in the content by quoting the variable name\necho \"#######ADDED BY installPHP script\" >> $HTACCESS\necho \"$HTACCESS_CONTENT\" >> $HTACCESS\nechoL2 \"--> Created $PHP_INI\"\n#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nrm -rf $BUILD_DIR\necho -n \"Delete the downloads directory? (y\/n): \"\nread DELETE_DOWNLOADS_DIR\nif [ $DELETE_DOWNLOADS_DIR = \"y\" ]; then\n    rm -rf $DOWNLOADS_DIR\nfi\nechoL1 \"DONE\"\nexit 0\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I&rsquo;ve recently been setting up my new dreamhost for symfony projects deployment and the only thing the default PHP is missing is the support for APC (alternate php cache).<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_themeisle_gutenberg_block_has_review":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[28],"tags":[125,93],"class_list":["post-116","post","type-post","status-publish","format-standard","hentry","category-web-development","tag-qgis-org","tag-symfony"],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":17,"url":"https:\/\/www.opengis.ch\/fr\/2009\/07\/10\/symfony-project-on-bluehost-shared-hosting\/","url_meta":{"origin":116,"position":0},"title":"Symfony project on (bluehost) shared hosting","author":"Marco Bernasocchi","date":"10 juillet 2009","format":false,"excerpt":"set up a working Symfony project (with SVN) on my bluehost shared hosting, this tutorial should work for other hosters with minor changes. What I wanted was to be able of using my account as a development server for a small group of developers that would automatically show the last\u2026","rel":"","context":"Dans &quot;Web Development&quot;","block_context":{"text":"Web Development","link":"https:\/\/www.opengis.ch\/fr\/category\/web-development\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":99,"url":"https:\/\/www.opengis.ch\/fr\/2009\/09\/17\/adapting-doctrineexport-grt-lua-to-symfony-standards\/","url_meta":{"origin":116,"position":1},"title":"Adapting doctrineexport.grt.lua to symfony standards","author":"Marco Bernasocchi","date":"17 septembre 2009","format":false,"excerpt":"Using Mysql workbench to visually design a data model for a symfony application is pretty cool. Thanks to the guys of https:\/\/code.google.com\/p\/mysql-workbench-doctrine-plugin\/ you can export the model to a YAML file ready for Doctrine. the only problem I found using version 0.36 is that classes names are not in UpperCamelCase\u2026","rel":"","context":"Dans &quot;Web Development&quot;","block_context":{"text":"Web Development","link":"https:\/\/www.opengis.ch\/fr\/category\/web-development\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":60,"url":"https:\/\/www.opengis.ch\/fr\/2009\/07\/14\/activating-error-503-from-a-shell-script\/","url_meta":{"origin":116,"position":2},"title":"Activating error 503 from a shell script","author":"Marco Bernasocchi","date":"14 juillet 2009","format":false,"excerpt":"During deployment of a new version of a website you might want to have your server returning an error 503 (temporarily unavailable). here a solution","rel":"","context":"Dans &quot;Web Development&quot;","block_context":{"text":"Web Development","link":"https:\/\/www.opengis.ch\/fr\/category\/web-development\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":108,"url":"https:\/\/www.opengis.ch\/fr\/2009\/10\/10\/mysql-world-database-as-yaml-fixture\/","url_meta":{"origin":116,"position":3},"title":"MySql World Database as YAML fixture","author":"Marco Bernasocchi","date":"10 octobre 2009","format":false,"excerpt":"For Symfony application I'm developing I needed all the Region separated by continent (7 continents model). I converted the MySql World Database (https:\/\/dev.mysql.com\/doc\/world-setup\/en\/world-setup.html) to a YAML NestedSet fixture file. I just had to make 4 minor changes to it: - rename the 3 continents that had region with the same\u2026","rel":"","context":"Dans &quot;Web Development&quot;","block_context":{"text":"Web Development","link":"https:\/\/www.opengis.ch\/fr\/category\/web-development\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":68,"url":"https:\/\/www.opengis.ch\/fr\/2009\/08\/07\/wordpress-wpml-iphone-app\/","url_meta":{"origin":116,"position":4},"title":"wordpress iphone app with wpml","author":"Marco Bernasocchi","date":"7 ao\u00fbt 2009","format":false,"excerpt":"Solution to use the iphone application for multilingual blogging with wpml","rel":"","context":"Dans &quot;Web Development&quot;","block_context":{"text":"Web Development","link":"https:\/\/www.opengis.ch\/fr\/category\/web-development\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":262,"url":"https:\/\/www.opengis.ch\/fr\/2011\/08\/02\/qgis-globe-runs-on-win\/","url_meta":{"origin":116,"position":5},"title":"QGIS Globe runs on Win","author":"Marco Bernasocchi","date":"2 ao\u00fbt 2011","format":false,"excerpt":"I just set up a win xp virtual box (remember to enable 3D acceleration) and to test out globe on windows. here what I did: Get OSGeo4W installer and run it Choose advanced install Select qgis-dev, osgearth-bin, osg-bin from the desktop packages Select osgeart-dev, osg-dev from libs Run Open Qgis,\u2026","rel":"","context":"Dans &quot;C++&quot;","block_context":{"text":"C++","link":"https:\/\/www.opengis.ch\/fr\/category\/programming\/cpp\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_shortlink":"https:\/\/wp.me\/pbdBtI-1S","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.opengis.ch\/fr\/wp-json\/wp\/v2\/posts\/116","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.opengis.ch\/fr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.opengis.ch\/fr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.opengis.ch\/fr\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.opengis.ch\/fr\/wp-json\/wp\/v2\/comments?post=116"}],"version-history":[{"count":1,"href":"https:\/\/www.opengis.ch\/fr\/wp-json\/wp\/v2\/posts\/116\/revisions"}],"predecessor-version":[{"id":11235,"href":"https:\/\/www.opengis.ch\/fr\/wp-json\/wp\/v2\/posts\/116\/revisions\/11235"}],"wp:attachment":[{"href":"https:\/\/www.opengis.ch\/fr\/wp-json\/wp\/v2\/media?parent=116"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.opengis.ch\/fr\/wp-json\/wp\/v2\/categories?post=116"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.opengis.ch\/fr\/wp-json\/wp\/v2\/tags?post=116"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}