Page 1 of 2 12 Last
  • Jump to page:
    #1
  1. No Profile Picture
    thelem
    Guest
    Devshed Newbie (0 - 499 posts)
    I currently run a Perl banner exchange but I am looking to convert it to PHP3 and MySQL. My only problem is all the members have code which points to a .cgi file.

    How can I get it so that just this one CGI file will be checked by the PHP parser? Either that or somehow get the CGI file to check a MySQL database, or PHP3 file.

    Also how can I get all .html files checked?
    I am running on a servers with about 2 hundred websites on it.

    Thanks,
    Lemming
  2. #2
  3. No Profile Picture
    rycamor
    Guest
    Devshed Newbie (0 - 499 posts)
    This might be a strange thought, but how about a simple workaround: Make a DIRECTORY with the same name as the .cgi file that the code points to. Then use an index.php3 file of that directory for your PHP code. You will have to make sure that Apache's (or whatever webserver) configuration file makes an index out of .php3 files, and your users will never know the difference:

    http://www.yourwebsite.com/cgi-bin/oldscript.cgi/(non-displaying index.php3)

    You're gonna love working with PHP with MySQL.

    Good luck
  4. #3
  5. No Profile Picture
    rycamor
    Guest
    Devshed Newbie (0 - 499 posts)
    To get all .html files checked by the PHP parser, you simply need to edit httpd.conf (again I am assuming Apache) and add .html to the PHP3 configuration area:

    AddType application/x-httpd-php3 .php3 .phtml (you would add .html)

    I would recommend you think carefully about doing this, though, because it makes PHP parse *every* web page on your site, whether its got PHP code or not, which will put a big load on your processor. And if this is a global configuration file, then PHP will have to parse every page on all 200 sites. I don't know an easy answer to this one.
  6. #4
  7. No Profile Picture
    thelem
    Guest
    Devshed Newbie (0 - 499 posts)
    That thing about having it as a directory index is a good idea, I currently use lots of .htaccess files to make sure the correct file is shown for the index, I just hope the extension won't confuse it. I recently updated the code and used exactly this trick so that I could use what ever technology I wanted.

    I doubt I will be able to get the .html files through the parser because I don't run the server. I read somewhere that search engines don't always index .php3 files, and I was going to make it so that .htm was pure html and .html would be php3 files.

    Thanks,
    Lemming,
    www.lemnet.com
  8. #5
  9. No Profile Picture
    Robman
    Guest
    Devshed Newbie (0 - 499 posts)
    Maybe I'm missing part of the problem but wouldn't a simple redirect statement in Apache's httpd.conf file do the trick? This is what I did when I replaced a .cgi with a .php3 and it worked perfectly.
  10. #6
  11. No Profile Picture
    rycamor
    Guest
    Devshed Newbie (0 - 499 posts)
    You are so correct sir... a simple redirect, the obvious solution. But you've got to admit my idea was kinda fun, and it might have its uses.

    Lemming -- find out if your server can parse server-side includes in regular .html files (instead of only .shtml files) then you can call your .php3 scripts INTO your .html files and the search engines will be none the wiser.
  12. #7
  13. No Profile Picture
    thelem
    Guest
    Devshed Newbie (0 - 499 posts)
    OK, so have can get round my original problem either way, but I now have a new problem - I want to read and write text files using PHP3. This is only temporary, and I know how to access MySQL using perl, but that needs my hosting company to upgrade something, and they are not that fast at responding to requests like this.

    So, can you access (existing) text files using PHP3?
  14. #8
  15. No Profile Picture
    rod k
    Guest
    Devshed Newbie (0 - 499 posts)
    Yes you can, check out the file system functions in the manual:

    http://www.phpbuilder.com/manual/ref.filesystem.php3

  16. #9
  17. No Profile Picture
    thelem
    Guest
    Devshed Newbie (0 - 499 posts)
    Thanks. I had looked for the same on devshed but I was sure I couldn't find anything (even if it was right under my nose). Anyway, they have dead links, and so do devshed, but I had the old manual pages bookmarked. Now I should hopefully be able to get this working :-)

    Thanks,
    Lemming
  18. #10
  19. No Profile Picture
    thelem
    Guest
    Devshed Newbie (0 - 499 posts)
    OK, those could do with being alot cleared. For instance when you are told that the code for an arrar is
    "array array(...);"
    it isn't too helpful. Might be OK if you know the language, but if you know the language you don't need it.
    Anyway, can anybody see the problem in this code:
    <?
    $lemnet = file(string german.txt);
    print "$lemnet";
    ?>

    the german.txt file exists and is in the same directory as the php file.

    Thanks,
    Lemming
  20. #11
  21. No Profile Picture
    Robman
    Guest
    Devshed Newbie (0 - 499 posts)
    Remove "string" from
    $lemnet = file(string german.txt);
    so it looks like this
    $lemnet = file(german.txt);

  22. #12
  23. No Profile Picture
    thelem
    Guest
    Devshed Newbie (0 - 499 posts)
    Thanks. That works.
  24. #13
  25. No Profile Picture
    rod k
    Guest
    Devshed Newbie (0 - 499 posts)
    In the manual where you see something like:

    int function_name(string)

    it is saying that function_name takes a string as an argument and returns an integer, so you'd write it like this:

    $some_integer_variable=function_name($some_string_variable); or

    $some_integer_variable=function_name('some string constant');

    HTH
  26. #14
  27. No Profile Picture
    thelem
    Guest
    Devshed Newbie (0 - 499 posts)
    Rod K: Thanks, that helped a bit.

    My problem now is that I can't find anyway to get a value from an array. I have tried $name[0], @name[0], $name(0) and many others, bot nothing seems to work and I can't find any mention of it in the manual (despite an entire section for arrays).

    Thanks,
    Lemming
  28. #15
  29. No Profile Picture
    rod k
    Guest
    Devshed Newbie (0 - 499 posts)
    Well, that's really not enough information to solve your problem. Arrays are referred to with brackets, i.e. $name[0] so that is correct. When you say it doesn't work do you mean you are getting an error, you don't get the value you expect, what?
    <?
    $name[]='Bill';
    $name[]='Hillary';
    $name[]='Al';
    $name[]='Tipper';
    $name[jerk]=$name[0];

    print $name[1]; // prints "Hillary"
    print $name[0]; // prints "Bill"
    print $name[jerk]; // prints "Bill"

Page 1 of 2 12 Last
  • Jump to page:

Similar Threads

  1. I know PHP: why learn PERL?
    By dreamstring in forum Perl Programming
    Replies: 6
    Last Post: February 19th, 2004, 09:17 AM
  2. Replies: 2
    Last Post: February 9th, 2004, 02:22 PM
  3. Perl to PHP converter
    By superprogrammer in forum Project Help Wanted
    Replies: 0
    Last Post: February 7th, 2004, 12:36 PM
  4. Pass Perl variable through PHP to browser?
    By dvd in forum Perl Programming
    Replies: 6
    Last Post: January 18th, 2004, 02:37 PM
  5. I've got PHP and I need Perl!
    By Jaydan_W in forum Perl Programming
    Replies: 4
    Last Post: January 17th, 2004, 02:00 AM

IMN logo majestic logo threadwatch logo seochat tools logo