Women in Technology

Hear us Roar



Article:
  Introduction to Socket Programming with PHP
Subject:   Re: unable to run this script
Date:   2003-01-26 22:20:59
From:   manjay_dwivedi
Response to: Re: unable to run this script

see how i'm trying to run this script


i put this script in my /var/www/html/sock/
folder


when i trying to run this through command line
./sock.php


it's shwing me error --no such directory or file found
but the file is exist in that directory
i'm using PHP ver-4.0 and Apachi server on linux .
could u plz tell wat the exact way .


Regards


Manjay



Full Threads Oldest First

Showing messages 1 through 4 of 4.

  • Re: unable to run this script
    2003-01-26 23:03:12  dsolin [View]

    Hi again!

    Given that /var/www/html is your web root, you can either run the script by making a usual HTTP request:

    http://localhost/sock/sock.php

    Or, you can (is you indicate above) run it via the command-line. However, to do this you must have PHP as a binary (a program that can interpret PHP code). If you don't know if you have this, try the following:

    root@localhost# cd /var/www/html/sock
    root@localhost# php sock.php

    If this get the script executed, you're safe. If it returns a "php: command not found", you need to install/compile a PHP binary.

    When you do have a PHP binary, you can also add a so-called "shebang" at the top of your script:

    #!/path/to/php

    and then do a 'chmod 755 sock.php' to make it executable. By this, you will be able to run the script by just typing its name on the command-line:

    root@localhost# cd /var/www/html/sock
    root@localhost# ./sock.php

    Hope this helps!

    Best,
    Dan
    • Re: unable to run this script
      2003-01-29 03:11:42  manjay_dwivedi [View]

      thankx a lot dear
      now i'm enable to run the script.

      thanx a lot 4 coopration.
    • Re: unable to run this script
      2003-01-29 02:45:00  manjay_dwivedi [View]

      how i find where is the binary of php on my linux server.
      Is the default path is --/usr/local/bin/

      yeah i got error when i trying to run php sock.php
      it's giving me command not found error .
      wat i should do ,where is the fault.

      plz try to solve the problem.


      Regards
      Manjay
      • Re: unable to run this script
        2003-01-29 02:51:12  dsolin [View]

        Hi again,

        Did you compile and install PHP from source? If so, recompile it but this time run the configure-script without the --with-apxs switch:

        cd <php-src-dir>
        ./configure --prefix=/usr/local
        make

        This should generate a php binary (a file called 'php') in your <php-src-dir>. Simply copy this file to /usr/local/bin:

        cp php /usr/local/bin

        If you installed PHP from a binary package, try to find a CGI-version of the package, and install that one. What Linux distribution do you use?

        Best,
        Daniel