RFC: CLI -x

From: Date: Fri, 22 Mar 2002 15:42:15 +0000
Subject: RFC: CLI -x
Groups: php.dev 
Request: Send a blank email to php-dev+get-81622@lists.php.net to get a copy of this message
I added new -x switch to CLI version which enables execution of files without having scripting tags. Suppose we have a file called /usr/bin/phpx: /usr/bin/php -x $1 EOF Suppose we have a file called hello.phpc #!/usr/bin/phpx echo "Hello ";echo"World!\n"; EOF Suppose we have a file called hello2.phpc #!/usr/bin/php -x $a = "Hello "; $b = "World!"; echo "$a $b\n"; EOF With this you can do: [marcus@marvin tmp]$ ./hello.phpc Hello World!\n [marcus@marvin tmp]$ phpx hello.phpc Hello World! [marcus@marvin tmp]$ ./hello2.phpc Hello World! [marcus@marvin tmp]$ About the implementation: I had very big problems with a nicer implementation. When using buffered copy operation using fread/fwrite i cannot copy any bytes ?!? (don't know why). When using streams every thing works fine but it i get segfault on php_request_shutdown(). It seems that the shutdown process closes the filepointer to the script and then frees the stream and segfaults because of php_stream_free working with an illegal file pointer. Any comments? marcus --------->>> mailto:marcus.boerger@post.rwth-aachen.de <<<------------
        I don't want to start any blashphemous rumours
        but i think that god's got a sick sense of humor
        and when i die i expect to find him laughing.
                                             Depeche Mode
--------------->>> http://www.marcus-boerger.de <<<-------------------

« previous php.dev (#81622) next »