Forráskód Böngészése

Merge pull request #2124 from knewmanTE/php-fixes

Fix configurations for broken PHP frameworks
Nate 9 éve
szülő
commit
3049b45564

+ 2 - 1
config/php.ini

@@ -868,9 +868,10 @@ default_socket_timeout = 60
 ;extension=apc.so
 zend_extension=opcache.so
 extension=redis.so
-extension=phalcon.so
+;extension=phalcon.so
 ;extension=yaf.so
 extension=mongodb.so
+extension=mongo.so
 ;extension=php_bz2.dll
 ;extension=php_curl.dll
 ;extension=php_fileinfo.dll

+ 2 - 2
frameworks/PHP/clancats/.gitignore

@@ -1,6 +1,6 @@
 public/assets/packtacular/
 CCF/app/config/migrator.json
-CCF/vendor/
+vendor/
 storage/
 .DS_Store
 Thumbs.db
@@ -10,4 +10,4 @@ phpunit.xml
 phpunit.phar
 report/
 run
-/clancatsapp/
+clancatsapp/

+ 0 - 14
frameworks/PHP/clancats/composer.json

@@ -7,19 +7,5 @@
 	"require": {
 		"clancats/core": "2.0.*"
 	},
-	"config": {
-		"vendor-dir": "CCF/vendor"
-	},
-	"scripts": {
-		"post-install-cmd": [
-			"php cli phpunit::build"
-		],
-		"post-update-cmd": [
-			"php cli phpunit::build"
-		],
-		"post-create-project-cmd": [
-			"php cli doctor::security_key"
-		]
-	},
 	"minimum-stability": "stable"
 }

+ 1 - 1
frameworks/PHP/clancats/setup.sh

@@ -12,7 +12,7 @@ git clone --branch v2.0.6 https://github.com/ClanCats/Framework.git clancatsapp
 
 cp -r app/ clancatsapp/CCF/
 
-cp -r CCF/vendor/ clancatsapp/CCF/
+cp -r vendor/ clancatsapp/CCF/
 
 php-fpm --fpm-config $FWROOT/config/php-fpm.conf -g $TROOT/deploy/php-fpm.pid
 nginx -c $TROOT/deploy/nginx.conf

+ 0 - 1
frameworks/PHP/cygnite-php-framework/benchmark_config.json

@@ -24,7 +24,6 @@
       "setup_file": "setup",
       "db_url": "/index.php/bench/db",
       "query_url": "/index.php/bench/queries/",
-      "fortune_url": "/index.php/bench/fortunes",
       "port": 8080,
       "approach": "Realistic",
       "classification": "Fullstack",

+ 1 - 1
frameworks/PHP/phalcon-micro/.gitignore

@@ -1,2 +1,2 @@
-/compiled-templates/
+/compiled-templates/*.c
 /deploy/php-fpm.pid

+ 0 - 0
frameworks/PHP/phalcon-micro/compiled-templates/.blank


+ 1 - 1
frameworks/PHP/phalcon-micro/setup.sh

@@ -1,6 +1,6 @@
 #!/bin/bash
 
-fw_depends php nginx
+fw_depends php phalcon nginx
 
 sed -i 's|localhost|'"${DBHOST}"'|g' public/index.php
 sed -i 's|root .*/FrameworkBenchmarks/php-phalcon-micro|root '"${TROOT}"'|g' deploy/nginx.conf

+ 1 - 1
frameworks/PHP/phalcon/.gitignore

@@ -1,6 +1,6 @@
 /app/cache
 /app/logs
-/app/compiled-templates/
+/app/compiled-templates/*.compiled
 /bin
 /vendors
 /build

+ 0 - 0
frameworks/PHP/phalcon/app/compiled-templates/.blank


+ 1 - 1
frameworks/PHP/phalcon/public/index.php

@@ -25,7 +25,7 @@ try {
         if (function_exists('apc_store')) {
             return new Phalcon\Mvc\Model\MetaData\Apc();
         } else {
-            return new Phalcon\Mvc\Model\MetaData\Files(array(
+            return new Phalcon\Mvc\Model\MetaData\Memory(array(
                 'metaDataDir' => APP_PATH . "/app/compiled-templates/"
             ));
         }

+ 1 - 1
frameworks/PHP/phalcon/setup.sh

@@ -1,6 +1,6 @@
 #!/bin/bash
 
-fw_depends php nginx
+fw_depends php phalcon nginx
 
 sed -i 's|mongodb://localhost|mongodb://'"${DBHOST}"'|g' app/config/config.php
 sed -i 's|localhost|'"${DBHOST}"'|g' app/config/config.php

+ 1 - 1
frameworks/PHP/yaf/setup.sh

@@ -1,6 +1,6 @@
 #!/bin/bash
 
-fw_depends php nginx
+fw_depends php yaf nginx
 
 sed -i 's|host=localhost|host='"${DBHOST}"'|g' app/conf/application.ini
 sed -i 's|root .*/FrameworkBenchmarks/php-yaf|root '"${TROOT}"'|g' deploy/nginx.conf 

+ 27 - 0
toolset/setup/linux/frameworks/phalcon.sh

@@ -0,0 +1,27 @@
+#!/bin/bash
+
+fw_depends php
+
+RETCODE=$(fw_exists ${IROOT}/phalcon.installed)
+[ ! "$RETCODE" == 0 ] || { \
+  source $IROOT/phalcon.installed
+  return 0; }
+
+# Enable the PHP phalcon extension
+sed -i 's|;extension=phalcon.so|extension=phalcon.so|g' $PHP_HOME/lib/php.ini
+
+fw_get -O https://github.com/phalcon/cphalcon/archive/phalcon-v1.3.2.tar.gz
+fw_untar phalcon-v1.3.2.tar.gz
+cd cphalcon-phalcon-v1.3.2/build/64bits 
+$PHP_HOME/bin/phpize
+# For some reason we have to point to php-config 
+# explicitly, it's not found by the prefix settings
+./configure --prefix=$PHP_HOME --exec-prefix=$PHP_HOME \
+  --with-php-config=$PHP_HOME/bin/php-config \
+  --enable-phalcon --quiet
+make --quiet
+make install
+
+echo "" > $IROOT/phalcon.installed
+
+source $IROOT/phalcon.installed

+ 16 - 0
toolset/setup/linux/frameworks/yaf.sh

@@ -0,0 +1,16 @@
+#!/bin/bash
+
+fw_depends php
+
+RETCODE=$(fw_exists ${IROOT}/yaf.installed)
+[ ! "$RETCODE" == 0 ] || { \
+  source $IROOT/yaf.installed
+  return 0; }
+
+# Enable the PHP yaf extension
+sed -i 's|;extension=yaf.so|extension=yaf.so|g' $PHP_HOME/lib/php.ini
+printf "\n" | $PHP_HOME/bin/pecl -q install -f yaf-2.2.9
+
+echo "" > $IROOT/yaf.installed
+
+source $IROOT/yaf.installed

+ 12 - 22
toolset/setup/linux/languages/php.sh

@@ -30,6 +30,15 @@ echo "Installing PHP quietly"
 make --quiet install
 cd ..
 
+# Disable yaf and phalcon, for most PHP frameworks 
+# (there is a similar line to enable the frameworks in their respective setup files)
+sed -i 's|^extension=yaf.so|;extension=yaf.so|g' $FWROOT/config/php.ini
+sed -i 's|^extension=phalcon.so|;extension=phalcon.so|g' $FWROOT/config/php.ini
+
+# Enable the correct Mongo DB plugin for PHP 5
+sed -i 's|^extension=mongodb.so|;extension=mongodb.so|g' $FWROOT/config/php.ini
+sed -i 's|;extension=mongo.so|extension=mongo.so|g' $FWROOT/config/php.ini
+
 cp $FWROOT/config/php.ini $PHP_HOME/lib/php.ini
 cp $FWROOT/config/php-fpm.conf $PHP_HOME/lib/php-fpm.conf
 
@@ -44,29 +53,10 @@ echo PHP compilation finished, installing extensions
 $PHP_HOME/bin/pecl channel-update pecl.php.net
 # Apc.so
 $PHP_HOME/bin/pecl config-set php_ini $PHP_HOME/lib/php.ini
-printf "\n" | $PHP_HOME/bin/pecl -q install -f redis
-
-# yaf.so
-# printf "\n" | $PHP_HOME/bin/pecl -q install -f yaf
-
-# phalcon.so
-#   The configure seems broken, does not respect prefix. If you 
-#   update the value of PATH then it finds the prefix from `which php`
-
-fw_get -O https://github.com/phalcon/cphalcon/archive/phalcon-v1.3.2.tar.gz
-fw_untar phalcon-v1.3.2.tar.gz
-cd cphalcon-phalcon-v1.3.2/build/64bits 
-$PHP_HOME/bin/phpize
-# For some reason we have to point to php-config 
-# explicitly, it's not found by the prefix settings
-./configure --prefix=$PHP_HOME --exec-prefix=$PHP_HOME \
-  --with-php-config=$PHP_HOME/bin/php-config \
-  --enable-phalcon --quiet
-make --quiet
-make install
+printf "\n" | $PHP_HOME/bin/pecl -q install -f redis-2.2.5
 
-# mongodb.so
-printf "\n" | $PHP_HOME/bin/pecl -q install -f mongodb
+# mongo.so
+printf "\n" | $PHP_HOME/bin/pecl -q install -f mongo
 
 # Clean up a bit
 rm -rf $IROOT/php

+ 4 - 0
toolset/setup/linux/languages/php7.sh

@@ -25,6 +25,10 @@ echo "Installing PHP quietly"
 make --quiet install
 cd ..
 
+# Enable the correct Mongo DB plugin for PHP 7
+sed -i 's|^extension=mongo.so|;extension=mongo.so|g' $FWROOT/config/php.ini
+sed -i 's|;extension=mongodb.so|extension=mongodb.so|g' $FWROOT/config/php.ini
+
 cp $FWROOT/config/php.ini $PHP_HOME/lib/php.ini
 cp $FWROOT/config/php-fpm.conf $PHP_HOME/lib/php-fpm.conf
 

+ 4 - 1
toolset/setup/linux/systools/composer.sh

@@ -14,7 +14,10 @@ fw_get -o composer-installer.php https://getcomposer.org/installer
 
 # Use the PHP and composer from our PHP_HOME directory and 
 # COMPOSER_HOME directories
-php composer-installer.php --install-dir=${COMPOSER_HOME}
+#
+# NOTE: if you decide to update the composer version, be sure to test ALL of the frameworks
+# that use composer, as some of them have been known to break on newer versions of composer.
+php composer-installer.php --install-dir=${COMPOSER_HOME} --version=1.0.0
 
 cd ..