Results 1 to 14 of 14

Thread: How to execute php scripts ?

  1. #1

    How to execute php scripts ?

    Hi there, i have installed on my ASUS WL500g Router, DD-WRT with PHP 5.2.5

    This is the package: http://ipkg.nslu2-linux.org/feeds/op...5-1_mipsel.ipk

    How do i run now a simple php script to see that PHP installed successfully ?

  2. #2
    Hi,

    I don't run DD-WRT, but generally speaking:

    'PHP is a script language which outputs HTML through a webserver. '

    In order to run php, you need to have a webserver which can run php.

    then you open your internet browser and point to a php file located on the webserver. If it's processed correctly (eg. the script finishes without errors and html is outputted), then you know php works.

    HTH.

  3. #3
    Write a simple php-script, like this one:
    PHP Code:
    <?php
    echo "Hello, World!\n";
    ?>
    then type in command prompt:
    Code:
    php /path/to/test.php
    It should print "Hello, World!". You may need to get the script execute-permission.

  4. #4
    Well...i did that i get an error like :

    Code:
    Bus error
    the syntax was : /jffs/tmp/www # php /jffs/tmp/www/phptest.php

  5. #5
    If i do this :

    Code:
    # /jffs/usr/bin/php /jffs/tmp/www/phptest.php
    i get :

    Code:
    Status: 404
    Content-type: text/html
    X-Powered-By: PHP/5.0.5
    
    No input file specified.

    Strange !!

  6. #6
    1. Path "/jffs/usr/bin/php" seems to be wrong. Optware-packages are always installed in "/opt". Are you sure you are trying to start the mentioned package? The output "PHP/5.0.5" does not match the php-version from optware-package (5.2.5).

    2. What prints command "php -v"?

    3. Also try switch "-f":
    Code:
    php -f /path/to/test.php
    4. There are two version of php-executable: CLI and CGI. Your output looks to be from CGI-version. It might be not bad, but the optware-package should install CLI (at least for oleg-feed).

  7. #7
    Well, any command issued with :

    # php (anything_here)

    outputs me the 'Bus error' message.

    Maybe the php that i installed is not working properly.

    After installing the ipkg, a script like :

    Code:
    #!/bin/sh
    
    export PHP_FCGI_CHILDREN=''
    PORT=1026
    BIN=/opt/bin/php-fcgi
    #/opt/etc/php.d
    
    case $1 in
     start)
      $BIN -b $PORT &
      ;;
     stop)
      kill Pidof phpM  ;;
     *)
      echo "usage: $0 (start|stop)"
      exit 1
    esac
    is found in /jffs/etc/init.d/php

    I've chmod this file :

    Code:
    # chmod +x php
    and then executed the file :

    Code:
    #./php start
    No output here.

    Instead if i would run :
    Code:
    #php start
    I get 'Bus error'.


    Maybe i should go on Oleg's firmware ?

  8. #8
    Oleg firmware is a lot more simple. I am sure you will get php
    running in no time.

  9. #9
    does it have web GUI ? or support for USB devices ?

    though ... it will be nice to make it work on dd-wrt...

  10. #10
    Well, I suppose the message 'Bus error' means that the package you have installed from optware-repository is not very good compatible with DD-WRT-firmware.

    #./php start
    No output here.
    Who knows, may be it's good to not have output there?

    What you need php for, webserver? Then try it with webserver. May be php-fcgi works better on DD-WRT than the command line version of php-executable.

  11. #11
    Quote Originally Posted by hugbug View Post
    What you need php for, webserver?
    No...i don't need it for a webserver.

    I have a script that must run constantly. It is provided by my ISP to have acces to internet. If i'am not running this script, i don't have acces to internet.

    So basically, it is a small script that sends some info to my ISP.

  12. #12
    Ok, i have installed Oleg's firmware, with php-thttpd.

    I can see now the phptest.php in browser, by running http://192.168.1.1:81/phptest.php but if i run from the console :

    Code:
    [admin@(none) www]$ php phptest.php
    php: can't load library 'libuClibc++.so.0'
    it say's something about a missing library.

    what next ??

  13. #13
    Look here - Optware-uClibcBuild, try "Upgrading from old wl500g package feed".
    If it does not work, reinstall all packages from scratch as described in "Installing and using the updated uClibc library on your Asus WL-500g router".

  14. #14
    solved even more simple.

    From:
    http://ipkg.nslu2-linux.org/feeds/un...l500g/Packages

    I found :

    Package: libuclibc++
    Version: 0.1.12-4
    Provides: libstdc++
    Section: libs
    Architecture: mipsel
    Maintainer: Leon Kos <oleo@email.si>
    MD5Sum: 8db957d42f78a51c126e0540939bda87
    Size: 49959
    Filename: libuclibc++_0.1.12-4_mipsel.ipk
    Source: http://cxx.uclibc.org/src/uClibc++-0.1.12.tbz2
    Description: C++ standard library designed for use in embedded systems

    So problem solved! thank you for your cooperation !

Similar Threads

  1. Вопросы по работе PHP на роутере
    By Jekl in forum Russian Discussion - РУССКИЙ (RU)
    Replies: 164
    Last Post: 21-10-2014, 12:45
  2. PHP on ASUSWL500-G Premium
    By simistef in forum WL-500gP Q&A
    Replies: 1
    Last Post: 20-02-2008, 18:44
  3. Bug in PHP 5.2.2-1 - new PHP version avaiable?
    By rj.2001 in forum WL-500g Q&A
    Replies: 0
    Last Post: 13-05-2007, 22:10
  4. Cannot execute scripts
    By kokoro in forum WL-500g Custom Development
    Replies: 1
    Last Post: 26-10-2006, 06:42

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •