yazakib Posted August 5, 2008 Share Posted August 5, 2008 hi, i'm reading through a tutorial book, but it only has references to using PHP on a windows based server. I'm using a mac server and was curious what the equivalents are. For example I'm trying to reference my HD and in the tutorial it has $dir_name = "c:/"; but obviously i dont have a c drive. would it just be $dir_name = "macintosh hd:/"; ? also the other question is, how do you navigate through the macintosh workspace? I know for example that ".." means to go back a directory in windows but what is it for mac? For example i'm trying to learn how to populate a list in PHP. so far the code is as follows: <? $dir_name = "macintosh hd:/"; $dir = opendir($dir_name); //open the directory $file_list = "<ul>"; // create variable for list while ($file_name = readdir($dir)) { if (($file_name != ".") && ($file_name != "..")) { $file_list .="<li>$file_name"; } } $file_list .= "</ul>"; closedir($dir); echo "<p>$dir_name</p>"; echo "<p>$file_list</p>"; ?> what would be the equivalent in mac terms? Link to comment https://forums.phpfreaks.com/topic/118331-solved-php-and-my-mac/ Share on other sites More sharing options...
realjumper Posted August 5, 2008 Share Posted August 5, 2008 On my mac the path is: /Library/WebServer/Documents where I have a standard install of php and mysql. To be sure though, copy the code below and place it in a file called (say) 'path.php' and browse to the file via your local webserver. It will give to the exact path to the location of 'path.php'. <font size="6"><b>Path Finder</b></font><br /><br /> <?php echo 'Just copy what\'s in the text box below is the path to this file:<br /><br /> <input type="text" size="100" value="', dirname(__FILE__), '/" id="realpath" /><br /><br /> <font color="red">MAKE SURE YOU DELETE THIS FILE AFTER FINISHING!</font>'; ?> Link to comment https://forums.phpfreaks.com/topic/118331-solved-php-and-my-mac/#findComment-608960 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.