2012-06-18 18 views

उत्तर

11

डिफ़ॉल्ट स्टब को संशोधित करना आसान है (php से संबंधित शेबैंग जोड़ना)।

// start buffering. Mandatory to modify stub. 
$phar->startBuffering(); 

// Get the default stub. You can create your own if you have specific needs 
$defaultStub = $phar->createDefaultStub('index.php'); 

// Adding files 
$phar->buildFromDirectory(__DIR__, '/\.php$/'); 

// Create a custom stub to add the shebang 
$stub = "#!/usr/bin/php \n".$defaultStub; 

// Add the stub 
$phar->setStub($stub); 

$phar->stopBuffering(); 
+9

के बाद से पीएचपी निष्पादन योग्य सभी सिस्टम पर '/ usr/bin/php' में नहीं है, यह' उपयोग करने के लिए # बेहतर है!/Usr/bin/env php' बजाय। Http://tech.vg.no/2012/02/21/dont-hardcode-php-executable-path-in-shebang/ – chiborg

+0

किसी कारण से यह मेरे उबंटू सर्वर 10.04LTS पर काम नहीं कर रहा था ... – magnetik

+0

क्या यह विधि विंडोज पर काम करती है? – weynhamz