i have php compiled as a cgi on solaris 2.6 with netscape 3.6 server. when i run a php script #!/usr/local/bin/php prints out at the top of each page. when i take line out of the script i get a server error:

trying to GET /test.php, cgieng_start_output reports: could not fork new process (exec() failure [Exec format error])

when put back in it works fine but it still prints out the #!/usr/local/bin/php at te top of each page. Does anyone have any idea how to hide this from priniting. also when i run a cgi script the perl location doesn't print so i don't think its the server. thanks

    try adding a -q switch like so:

    #!/path/php -q
    <?
    code goes here
    ?>

    How are you running the script, by the way, like this:

    php scriptname

    or like this:

    ./scriptname
    /path/scriptname

      when i put the -q in i get no input file selected. By the way this is trying to access it from the web. When i do it by the command line it doesn't show up. any other suggestions? let me know if you want to see the phpinfo page it prints out.

        If you are using Apache Web Server add lines similar to this.

        ScriptAlias /php/ "c:/usr/bin/php/"
        AddType application/x-httpd-php .php
        AddType application/x-httpd-php-source .phps
        Action application/x-httpd-php "/php/php"

        Note: You do need a web server to run php files properly.

          The '#!/path/php -q' line should only go on top of script files run from a shell prompt. If you are running them via a web server, then you need to leave that line out, and simply add an extension like .php that your webserver understands as the one usef for php files. After that, read the post by werkerholic for the rest of the story.

            still no luck. i think it might have something to do with the webserver. if anyone has set up netscape server 3.6 using the cgi could they please tell me what they put in the obj.conf. it seems strange to me that no where do i actually tell the server where the php bianary is. maybe that is because it should be in the $PATH variable which it is. when run from the command line the #!/usr/bin/php doesn't show up. only when accessing it from the web.

              a year later

              Casey,

              could you indicate me, what are the steps (step by step) to install PHP in Solaris as CGI. Do I need a server to run the script?

              I´ve tried to install, but the executable (php) doesn´t appear in no directory. I think my configuration is not good.

              Please, could you help me. It´s very importan. I only want to run a script in the machine.

              Thanks,

                Write a Reply...