URL: https://www.opennet.ru/cgi-bin/openforum/vsluhboard.cgi
Форум: vsluhforumID8
Нить номер: 2409
[ Назад ]

Исходное сообщение
"Web ПРограмминг C++/PHP"

Отправлено Madjack , 15-Июн-04 23:59 
Есть страничка написаная на c++. В ее срединку нужно вставить код на PHP. Как это сделать?! Тупое исполнение exec( "php", "test.php" ) не помогает =(((

Содержание

Сообщения в этом обсуждении
"Web ПРограмминг C++/PHP"
Отправлено Rohan , 16-Июн-04 00:09 
php --help
Usage: php [-q] [-h] [-s] [-v] [-i] [-f <file>]
       php <file> [args...]
  -a               Run interactively
  -C               Do not chdir to the script's directory
  -c <path>|<file> Look for php.ini file in this directory
  -n               No php.ini file will be used
  -d foo[=bar]     Define INI entry foo with value 'bar'
  -e               Generate extended information for debugger/profiler
  -f <file>        Parse <file>.  Implies `-q'
  -h               This help
  -i               PHP information
  -l               Syntax check only (lint)
  -m               Show compiled in modules
  -q               Quiet-mode.  Suppress HTTP Header output.
  -s               Display colour syntax highlighted source.
  -v               Version number
  -w               Display source with stripped comments and whitespace.
  -z <file>        Load Zend extension <file>.


Примерно так.

Либо ЕСЛИ в файле ИСКЛЮЧИТЕЛЬНО PHP (в смысле как <?php в начале открылось, и до самого конца исполняемый код)

убираешь из файла <?php ?> или подобные тэги
прописываешь в начало #!/usr/local/etc/php
ну или где он там лежит..
и права на выполнение на забыть, однако


"Web ПРограмминг C++/PHP"
Отправлено Madjack , 16-Июн-04 01:14 
Content-type: text/html Security Alert! The PHP CGI cannot be accessed directly.

This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that a page will only be served up if the REDIRECT_STATUS CGI variable is set, e.g. via an Apache Action directive.

For more information as to why this behaviour exists, see the manual page for CGI security.

For more information about changing this behaviour or re-enabling this webserver, consult the installation file that came with this distribution, or visit the manual page.

Вот такую вот какашку мне говорит пхп


"Web ПРограмминг C++/PHP"
Отправлено vnp , 16-Июн-04 21:42 

>Security Alert! The PHP CGI cannot be accessed directly.
>
>This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that
>a page will only be served up if the REDIRECT_STATUS CGI
>variable is set, e.g. via an Apache Action directive.

Ну так дайте ему REDIRECT_STATUS, если он так на этом настаивает. man setenv.

Другой (более опасный) способ -- прописать
cgi.force_redirect = 0
в php.ini

>For more information as to why this behaviour exists, see the manual
>page for CGI security.

И это полезно. Например,
http://www.php.net/security.cgi-bin

>For more information about changing this behaviour or re-enabling this webserver, consult
>the installation file that came with this distribution, or visit the
>manual page.
>
>Вот такую вот какашку мне говорит пхп



"Web ПРограмминг C++/PHP"
Отправлено Madjack , 17-Июн-04 09:37 
>
>>Security Alert! The PHP CGI cannot be accessed directly.
>>
>>This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that
>>a page will only be served up if the REDIRECT_STATUS CGI
>>variable is set, e.g. via an Apache Action directive.
>
>Ну так дайте ему REDIRECT_STATUS, если он так на этом настаивает. man
>setenv.
>
>Другой (более опасный) способ -- прописать
>cgi.force_redirect = 0
>в php.ini
>
>>For more information as to why this behaviour exists, see the manual
>>page for CGI security.
>
>И это полезно. Например,
>http://www.php.net/security.cgi-bin
>
>>For more information about changing this behaviour or re-enabling this webserver, consult
>>the installation file that came with this distribution, or visit the
>>manual page.
>>
>>Вот такую вот какашку мне говорит пхп

Да. Все теперь обрабатывается, но... он выдает бинарник. А мне нужен обычный текст.

К примеру пишу в пхп файле:
#!/usr/bin/php -q
print( "test<br>" );

А она мне выдает Content-type: text/html ELF И дальше код бинарника идет на два листа.