Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19
PHP in shell
Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: PHP in shell

  1. #1
    Junior Member
    Join Date
    May 2002
    Posts
    89

    PHP in shell

    Hi
    I can program (not very well) in PHP and no nothing about BASH/Shell, is it possible to write PHP scripts for bash, e.g. making a firewall?

    thanks

  2. #2
    Mentor coltrane's Avatar
    Join Date
    May 2001
    Location
    North Carolina
    Posts
    1,390

    Re:PHP in shell

    yes, lemme find out how
    There's a switch for it

  3. #3
    Mentor coltrane's Avatar
    Join Date
    May 2001
    Location
    North Carolina
    Posts
    1,390

    Re:PHP in shell

    Code:
    #!/usr/bin/php -q
    <?php
    And that will suppress http header information.
    Though Im not sure Id recommend it as the first language to use for scripting.

    To each his own of course, do that which makes you comfortable, but personally Id start with PERL.

    $0.02

  4. #4
    Junior Member
    Join Date
    May 2002
    Posts
    89

    Re:PHP in shell

    thanks
    Ive looked at perl, it just dont seem right, and PHP is simple. I think

  5. #5

    Re:PHP in shell

    Are you trying to make a firewall configuration tool or an actual firewall? If you just want to write a firewall, script it. Its very simple. If you are trying to make a configuration tool that takes input from the shell (like pmfirewall), I don't think PHP is the right tool for the job. I'd have to say I'd go with something like perl or bash.

  6. #6
    Junior Member
    Join Date
    May 2002
    Posts
    89

    Re:PHP in shell

    Hi
    Im more looking to write a script that loads information from txt files e.g. blocked IP's, FOrwarded Ports, etc...
    And i dotn really know much bout bash

  7. #7

    Re:PHP in shell

    you don't really have to know any bash at all (or very very little). Just look at some example scripts to get the iptables syntax down, write your rules into a text file and make it executable. Doing this in PHP would just cause you extra, unneeded work and confusion.

  8. #8
    Junior Member
    Join Date
    May 2002
    Posts
    89

    Re:PHP in shell

    [quote author=tolstoy link=board=9;threadid=3905;start=0#39287 date=1025070440]
    you don't really have to know any bash at all (or very very little). Just look at some example scripts to get the iptables syntax down, write your rules into a text file and make it executable. Doing this in PHP would just cause you extra, unneeded work and confusion.
    [/quote]

    Well... What I was more thinking of is writing a script in PHP that basically creates a Firewall... BUT! instead of writing
    Code:
    iptables bla bla bla
    to block a single ip address, it reads a text file with IP addresses in it and creates the script on the fly ah, im crap in english, if you dont understand, you will when i post the script as my project at sourceforge, you will realise that it is a brilliant idea, the queen will read it, the preisdent of the US will read it, see it as a brilliant idea and give me complete power over their country! MaWaHaHaHaaa! </mindless endless pointless nonsense rant>
    Felt good to get that off my chest

  9. #9
    Mentor coltrane's Avatar
    Join Date
    May 2001
    Location
    North Carolina
    Posts
    1,390

    Re:PHP in shell

    Wheres a Feztaa comment when you need it ?
    ;D

  10. #10

    Re:PHP in shell

    Well, reading stuff from a file and using it to generate stuff automatically is pretty easy in perl. I use perl to generate my .muttrc every time mutt loads... perl reads a file to figure out who I should be gpg-signing my messages to, among other things. This really sounds like something that would be easy to do in perl

    Don't write too many iptables rules, though. If you have too many, it gets SLOOOOOWWWW.

Similar Threads

  1. Slackware Shell
    By vern in forum Linux - General Topics
    Replies: 38
    Last Post: 12-16-2004, 01:25 AM
  2. shell access?
    By Rastar in forum Linux - Hardware, Networking & Security
    Replies: 2
    Last Post: 01-03-2003, 08:13 PM
  3. Shell commands from PHP?
    By tolstoy in forum Linux - Software, Applications & Programming
    Replies: 2
    Last Post: 06-13-2002, 03:25 PM
  4. How the Shell did I get to Thailand?
    By Rastar in forum General Chat
    Replies: 6
    Last Post: 06-07-2002, 02:14 PM
  5. My Dos shell
    By kenshi in forum Linux - Software, Applications & Programming
    Replies: 24
    Last Post: 11-29-2001, 11:10 PM

Bookmarks

Posting Permissions

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