wget http://ar2.php.net/distributions/php-5.5.30.tar.gz tar -zxvf php-5.5.30.tar.gz cd php-5.5.30.tar.gz ./configure \ --prefix=$OPENSHIFT_DATA_DIR/php \ --with-config-file-path=$OPENSHIFT_DATA_DIR/php/etc \ --with-mysql=mysqlnd \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --enable-embedded-mysqli=shared \ --enable-pdo \ --enable-fpm \ --with-zlib \ --enable-xml \ --enable-bcmath \ --with-curl \ --with-gd \ --enable-zip \ --enable-mbstring \ --enable-sockets \ --enable-ftp \ --with-iconv-dir \ --with-freetype-dir \ --with-jpeg-dir \ --with-png-dir \ --with-libxml-dir=/usr \ --disable-rpath \ --enable-shmop \ --enable-sysvsem \ --enable-sysvshm \ --enable-sysvmsg \ --enable-inline-optimization \ --enable-mbregex \ --enable-gd-native-ttf \ --with-openssl \ --with-mhash \ --enable-pcntl \ --enable-sockets \ --enable-ftp \ --enable-calendar \ --enable-exif \ --enable-zip \ --with-gettext \ --with-xmlrpc \ --with-xsl \ --with-bz2 \ --enable-wddx \ --enable-opcache \ --without-pear make make install
cp php.ini-production $OPENSHIFT_DATA_DIR/php/etc/php.ini cp $OPENSHIFT_DATA_DIR/php/etc/php-fpm.conf.default $OPENSHIFT_DATA_DIR/php/etc/php-fpm.conf vi $OPENSHIFT_DATA_DIR/php/etc/php-fpm.conf listen = var/run/php-fpm.sock listen.owner = 561620207628e1c367000169 listen.group = 561620207628e1c367000169 其中 561620207628e1c367000169 为你的当前用户名 vi $OPENSHIFT_DATA_DIR/conf/nginx.conf.template ... root /var/lib/openshift/561620207628e1c367000169/app-root/repo/diy; location / { index index.php index.html index.htm; } ... location ~ \.php$ { try_files $uri =404; fastcgi_pass unix:/var/lib/openshift/561620207628e1c367000169/app-root/data/php/var/run/php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $OPENSHIFT_REPO_DIR/diy$fastcgi_script_name; include fastcgi_params; } 其中 /var/lib/openshift/561620207628e1c367000169/app-root/data 为 $OPENSHIFT_DATA_DIR
在本地程序目录中修改 vi .openshift/action_hooks/start 追加: nohup $OPENSHIFT_DATA_DIR/php/sbin/php-fpm > $OPENSHIFT_DIY_LOG_DIR/server.log 2>&1 & vi .openshift/action_hooks/stop 追加: killall php-fpm