Easy fix I'm sure, but I'm stuck

Discussion in 'Co-op Advertising Network' started by Jester, Jul 22, 2005.

  1. #1
    Hello,

    I have a file called test.php. When I execute it I get:

    PHP Warning: main(ad_network_325.php): failed to open stream: No such file or directory in /path/to/my/test.php on line 3

    Can someone give me a hand with this?

    Thanks tons

    J
     
    Jester, Jul 22, 2005 IP
  2. Shoemoney

    Shoemoney $

    Messages:
    4,474
    Likes Received:
    588
    Best Answers:
    0
    Trophy Points:
    295
    #2
    is your directory really /path/to/my/test.php ???

    if not make it the real path

    like for unix generally /home/username/html/test.php

    windows usually c:/somedir/html/test.php (i dont have much experience with windows servers so dunno)
     
    Shoemoney, Jul 22, 2005 IP
  3. Jester

    Jester Well-Known Member

    Messages:
    202
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    148
    #3
    Well, no, it's like that for privacy. Not only that, but this is in error_log on my webserver for this domain. It does show the correct path to test.php.

    Thanks, but I still need a fix for this error. It apparently can't find the ad script. Which is in the root of the website along with a chmod 666 .txt file of the same name. :(

    J
     
    Jester, Jul 22, 2005 IP
  4. exam

    exam Peon

    Messages:
    2,434
    Likes Received:
    120
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Before tryinig to include the adnetwork file, do you have the line (ini_set) where it changes the "path" variable for php? (see code below) If you don't have this line, the ad_network_325 file would need to be in the same directory as your text.php file. Also, if your ad_network_325 file is more than 4 directories up, it won't work. To help this, change this line
    ini_set ("include_path", ini_get ("include_path") . ':../:../../:../../../:../../../../');
    and ad more dots and slashes like so
    ini_set ("include_path", ini_get ("include_path") . ':../:../../:../../../:../../../../:../../../../../:../../../../../../:../../../../../../../');

    <?php
    ini_set ("include_path", ini_get ("include_path") . ':../:../../:../../../:../../../../');
    include ('ad_network_325.php');
    echo $ad_network;
    ?>
    Code (markup):
    Also, the ad_network file needs to be in the base directory of the site. To get around these limitations, you could specify the correct path in the include.
    Hope some of that made sense :eek:
     
    exam, Jul 22, 2005 IP
  5. Jester

    Jester Well-Known Member

    Messages:
    202
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    148
    #5
    It made perfect sense, but same error, except with alot more dots and dashes.

    [client xxxxxxx] PHP Warning:  main(ad_network_325.php): failed to open stream: No such file or directory in /path/to/my/picturepuppy/test.php on line 3
    [client xxxxxxx] PHP Warning:  main(): Failed opening 'ad_network_325.php' for inclusion (include_path='.:/usr/local/php/lib/php:../:../../:../../../:../../../../:../../../../../:../../../../../../:../../../../../../../') in /path/to/my/picturepuppy/test.php on line 3
    [client xxxxxxx] PHP Notice:  Undefined variable:  ad_network in /path/to/my/picturepuppy/test.php on line 4
    
    Code (markup):
    I have the php file in the root of the site, as well as the .txt file. Named and chmod'd properly.

    Thanks for trying. :(

    J
     
    Jester, Jul 22, 2005 IP
  6. frankm

    frankm Active Member

    Messages:
    915
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    83
    #6
    Try this:

    
    <?php
    include ('/path/to/my/website/ad_network_325.php');
    echo $ad_network;
    ?>
    
    PHP:
    that should work
     
    frankm, Jul 22, 2005 IP
  7. Jester

    Jester Well-Known Member

    Messages:
    202
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    148
    #7
    Unfortunately the same result. I may just have to give up. The setup is so simple though. Very frustrating.

    Thanks again frankm,

    J
     
    Jester, Jul 22, 2005 IP
  8. frankm

    frankm Active Member

    Messages:
    915
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    83
    #8
    frankm, Jul 22, 2005 IP
  9. Jester

    Jester Well-Known Member

    Messages:
    202
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    148
    #9
    I wish I could be called an idiot, but check out this pic, taken minutes ago of the server's dir...

    [​IMG]

    Thank you for trying that, I didn't think to. Now...why would it not see it even if it's there? Ahah, YOU had the typo...... I'll try it now.

    OK, bad things happen. I renamed it. eeep.

    I don't think you can just call directly to the ad file.......

    Thanks

    J

    PS In the space of 30 seconds it created a 300MB error_log... I'm thinking it's a bad thing to call the script directly.
     
    Jester, Jul 22, 2005 IP
  10. frankm

    frankm Active Member

    Messages:
    915
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    83
    #10
    but I still get a 404 error ... It looks like the file does not exists (at least your apache server tells me so)

    try this:
    copy the file to a.php
    remove the original ad_network_325.php
    rename a.php to 'ad_network_325.php'
    and make sure there are not extra spaces, dots or _'s
     
    frankm, Jul 22, 2005 IP
  11. Jester

    Jester Well-Known Member

    Messages:
    202
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    148
    #11
    I had to rename it. I couldn't have others connecting to that url..... it did bad things.

    :(

    I'll keep digging, I personally find it hard to drop anything without getting it running.

    Thanks

    J
     
    Jester, Jul 22, 2005 IP
  12. frankm

    frankm Active Member

    Messages:
    915
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    83
    #12
    i'm sorry i can't help you get it right jester -- good luck retrying

    When I get in a situation like this: just start all over again -- can do wonders

    good luck
     
    frankm, Jul 22, 2005 IP