Created
April 12, 2011 17:42
-
-
Save skremiec/916005 to your computer and use it in GitHub Desktop.
Silex problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This code works perfectly on two different servers (running PHP 5.3.2 and PHP 5.3.3). | |
Unfortunately it fails on the third one (PHP 5.3.4). | |
On very first request, just after downloading silex.phar, it produces: | |
Fatal error: Class 'Silex\Application' not found in /home/users/abc/public_html/index.php on line 7 | |
And any following request ends with: | |
Fatal error: Uncaught exception 'PharException' with message '__HALT_COMPILER(); must be declared in a phar' in /home/users/abc/public_html/silex.phar:8 | |
Stack trace: | |
#0 /home/users/abc/public_html/silex.phar(8): Phar::webPhar(NULL, '_web_stub.php') | |
#1 /home/users/abc/public_html/index.php(3): require('/home/users/abc...') | |
#2 {main} thrown in /home/users/abc/public_html/silex.phar on line 8 | |
Any idea what could possibly went wrong? | |
Full list of failing server's PHP modules, extracted from phpinfo(): | |
- apache2handler | |
- bcmath | |
- bz2 | |
- calendar | |
- Core | |
- ctype | |
- curl | |
- date | |
- dba | |
- dio | |
- dom | |
- eAccelerator | |
- ereg | |
- exif | |
- fileinfo | |
- filter | |
- ftp | |
- gd | |
- gettext | |
- hash | |
- iconv | |
- imagick | |
- imap | |
- intl | |
- json | |
- libxml | |
- mbstring | |
- mcrypt | |
- mhash | |
- mysql | |
- mysqli | |
- mysqlnd | |
- odbc | |
- openssl | |
- pcre | |
- PDO | |
- pdo_mysql | |
- PDO_ODBC | |
- pdo_pgsql | |
- pdo_sqlite | |
- pgsql | |
- Phar | |
- posix | |
- pspell | |
- Reflection | |
- session | |
- shmop | |
- SimpleXML | |
- soap | |
- sockets | |
- SPL | |
- SQLite | |
- sqlite3 | |
- standard | |
- suhosin | |
- sysvmsg | |
- tidy | |
- tokenizer | |
- uploadprogress | |
- wddx | |
- xml | |
- xmlreader | |
- xmlwriter | |
- xsl | |
- zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require __DIR__.'/silex.phar'; | |
use Silex\Application; | |
$app = new Application(); | |
$app->match('/', function () { | |
return 'Works!'; | |
}); | |
$app->run(); |
The position of the autoload.php in silex.phar seems to have changed. The workaround for the Phar-Stub bug is now:
require_once 'phar://'.__DIR__.'/silex.phar/vendor/.composer/autoload.php';
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for your responses.
After some investigation (and looking into system logs) it turned out that it was caused by the suhosin patch - it was blocking this phar as a potential system security threat.