Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2012
    Thanked 0 Times in 0 Posts

    PHP code not working on a certain server


    I have the following code in my application and it is not working on a certain VPS server and I have no idea why.

    Server: Linux - PHP Version 5.3.16

    PHP Code:

    // Gets project names from the projects folder.
    function projects() {
    $projects glob(PROJECTS_DIR.'*'GLOB_ONLYDIR);
    for (
    $i=0$i<count($projects); $i++) {
    $projects[$i] = basename($projects[$i]);

    $projects projects();

    if (empty(
    $projects)) {
    'No projects found.';

    The above code works fine on all other servers I tested but not on this one. No error, no output. What could be the reason? What should I check in phpinfo() or php.ini? Something to do with glob()?

    Thanks for any ideas.

  2. #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Saskatoon, Saskatchewan
    Thanked 2,668 Times in 2,637 Posts
    Given what you have here, if you have no output than you successfully iterated the ../projects directory with the glob and returned matching subdirectories. The only time you'll have output is on an error.
    If there's more to it than this, than I'd suggest checking the HTML output to see if its a white page, or if it has PHP embedded within it. If it has PHP embedded, you simply don't have the server set up to process PHP code.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)


Posting Permissions

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