CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   PHP (http://www.codingforums.com/forumdisplay.php?f=6)
-   -   PHP code not working on a certain server (http://www.codingforums.com/showthread.php?t=286232)

envayo 01-22-2013 07:58 AM

PHP code not working on a certain server
 
Hi,

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:

<?php
define
('PROJECTS_DIR''../projects/');

// 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]);
}
return 
$projects;
}

$projects projects();


if (empty(
$projects)) {
echo 
'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.

Fou-Lu 01-22-2013 02:01 PM

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.


All times are GMT +1. The time now is 02:44 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.