mike2 Posted May 2, 2014 Share Posted May 2, 2014 I want to be able to search for PDF files but this time instead of them being run from the /var/www/html/pdf2 directory, I want to see if I can run them from the /home/wvbadmin/pdf2 directory. I just tried doing that and when I typed in my example word 'test' to do it. I got this error message: Search Results ERROR: Could not open the index file '/home/wvbadmin/pdf2/index.swish-e': Permission denied Here is my modified code: I want to be able to search for PDF files as well as the ability to be linked up to each PDF file respectively. <html> <head></head> <body> <?php if (!isset($_POST['q'])) { ?> <h2>Search</h2> <form method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>"> <input type="text" name="q" size="30" /> </form> <?php } else { ?> <h2>Search Results</h2> <?php try { // create object // $swish = new Swish('/usr/local/apache/htdocs/swish/index.swish-e'); $swish = new Swish('/home/wvbadmin/pdf2/index.swish-e'); // get and run query from command-line $queryStr = htmlentities($_POST['q']); $result = $swish->query($queryStr); ?> Found <?php echo $result->hits; ?> match(es) for '<?php echo $queryStr; ?>'. <?php // iterate over result set // print details for each match while($r = $result->nextResult()) { ?> <p> <?php echo $r->swishreccount; ?> <strong> <a href="<?php echo '/pdf2', ltrim($r->swishdocpath, '.') ; ?>"> <?php echo $r->swishdocpath; ?> </a> </strong> (score: <?php echo $r->swishrank; ?>) <br/><?php echo $r->swishdocpath; ?> </p> <?php } } catch (Exception $e) { die('ERROR: ' . $e->getMessage()); } } ?> </body></html> What I don't get is why will it work in the /var/www/html/pdf2 directory but not for the /home/wvbadmin/pdf2 directory? I get a permisssion error as shown above. I want to grab and search the PDF files from that particular directory. I am able to connect to the PDF files now. But my question is if I wanted to change the directory to /home/wvbadmin/pdf2 and grab those PDF files from there. Would I be able to do it? If so how? Quote Link to comment https://forums.phpfreaks.com/topic/288182-directory-location-question/ Share on other sites More sharing options...
jazzman1 Posted May 2, 2014 Share Posted May 2, 2014 You should set permissions of 755 to "/home/wvbadmin/" to let the php parser to read and execute documents/files contained therein. My suggestion is: su -c 'chmod 755 /home/wvbadmin/ -R' or sudo chmod 755 /home/wvbadmin/ -R Quote Link to comment https://forums.phpfreaks.com/topic/288182-directory-location-question/#findComment-1477947 Share on other sites More sharing options...
mike2 Posted May 2, 2014 Author Share Posted May 2, 2014 You should set permissions of 755 to "/home/wvbadmin/" to let the php parser to read and execute documents/files contained therein. My suggestion is: su -c 'chmod 755 /home/wvbadmin/ -R' or sudo chmod 755 /home/wvbadmin/ -R I did that and I am still getting the same permissions denied error. Quote Link to comment https://forums.phpfreaks.com/topic/288182-directory-location-question/#findComment-1477958 Share on other sites More sharing options...
jazzman1 Posted May 2, 2014 Share Posted May 2, 2014 Open up a linux console (as a regular user) and run (copy/paste) the following command. php -r 'print_r(glob("/home/wvbadmin/pdf2/*.pdf",true));' What linux distro is that? Quote Link to comment https://forums.phpfreaks.com/topic/288182-directory-location-question/#findComment-1477974 Share on other sites More sharing options...
mike2 Posted May 5, 2014 Author Share Posted May 5, 2014 Open up a linux console (as a regular user) and run (copy/paste) the following command. php -r 'print_r(glob("/home/wvbadmin/pdf2/*.pdf",true));' What linux distro is that? The Linux distribution I am using if Linux CentOS 6.5. What is this command going to do? Quote Link to comment https://forums.phpfreaks.com/topic/288182-directory-location-question/#findComment-1478246 Share on other sites More sharing options...
mike2 Posted May 5, 2014 Author Share Posted May 5, 2014 (edited) Open up a linux console (as a regular user) and run (copy/paste) the following command. php -r 'print_r(glob("/home/wvbadmin/pdf2/*.pdf",true));' What linux distro is that? I ran the command. Just like you told me to do and here is the output. I ran it twice. Here is the output for first time I ran it with the lowercase .pdf php -r 'print_r(glob("/home/wvbadmin/pdf2/*.pdf",true));' Array ( ) Here is the second time I ran it with the uppercase .PDF php -r 'print_r(glob("/home/wvbadmin/pdf2/*.PDF",true));' Array ( [0] => /home/wvbadmin/pdf2/AUS000030444.2013.A.00.E.09.30.PDF [1] => /home/wvbadmin/pdf2/BEL000030189.2011.4U.00.L.12.31.PDF [2] => /home/wvbadmin/pdf2/BGD000030255.2013.A.00.E.06.30.PDF [3] => /home/wvbadmin/pdf2/CAN000031319.2013.3.00.E.09.30.PDF [4] => /home/wvbadmin/pdf2/CAN000033815.2007.3.00.E.07.31.PDF [5] => /home/wvbadmin/pdf2/CAN000034122.2013.A.00.E.09.30.PDF [6] => /home/wvbadmin/pdf2/CAN000034434.2013.A.00.E.09.30.PDF [7] => /home/wvbadmin/pdf2/CHL000030412.2008.3.00.L.09.30.PDF [8] => /home/wvbadmin/pdf2/CHN000040802.2011.A.00.L.12.31.PDF [9] => /home/wvbadmin/pdf2/COL000030189.2008.A.00.L.12.31.PDF [10] => /home/wvbadmin/pdf2/CPV000030004.2012.A.00.L.12.31.PDF [11] => /home/wvbadmin/pdf2/CRI000030034.2005.A.00.L.12.31.PDF [12] => /home/wvbadmin/pdf2/CRI000030039.2009.A.00.L.12.31.PDF [13] => /home/wvbadmin/pdf2/CRI000030049.2009.A.00.L.12.31.PDF [14] => /home/wvbadmin/pdf2/CYM000030017.2013.A.00.E.09.30.PDF [15] => /home/wvbadmin/pdf2/CYM000040027.2012.A.00.L.03.31.PDF [16] => /home/wvbadmin/pdf2/CYM000040323.2007.4.00.E.12.31.PDF [17] => /home/wvbadmin/pdf2/CYP000030004.2013.3.00.E.09.30.PDF [18] => /home/wvbadmin/pdf2/FRA000031191.2012.U.00.L.12.31.PDF [19] => /home/wvbadmin/pdf2/FRA000040051.2011.AMF.00.L.12.31.PDF [20] => /home/wvbadmin/pdf2/GBR000031434.2013.A.00.E.03.31.PDF [21] => /home/wvbadmin/pdf2/GBR000031660.2013.A.00.E.03.31.PDF [22] => /home/wvbadmin/pdf2/GBR000032747.2013.A.00.E.06.30.PDF [23] => /home/wvbadmin/pdf2/GBR000032941.2013.A.00.E.09.30.PDF [24] => /home/wvbadmin/pdf2/GBR000033415.2013.4.00.E.12.31.PDF [25] => /home/wvbadmin/pdf2/GBR000033875.2012.U.00.E.12.02.PDF [26] => /home/wvbadmin/pdf2/GBR000091083.2013.A.00.E.09.30.PDF [27] => /home/wvbadmin/pdf2/HKG000020014.2008.3.00.L.09.30.PDF [28] => /home/wvbadmin/pdf2/HKG000030864.2008.A.00.L.12.31.PDF [29] => /home/wvbadmin/pdf2/HKG000030882.2013.A.00.L.12.31.PDF [30] => /home/wvbadmin/pdf2/HKG000030958.2008.A.00.L.12.31.PDF [31] => /home/wvbadmin/pdf2/HND000030021.2012.L.00.L.12.31.PDF [32] => /home/wvbadmin/pdf2/HUN000040038.2012.A.00.L.12.31.PDF [33] => /home/wvbadmin/pdf2/IDN000030159.2013.A.00.E.12.31.PDF [34] => /home/wvbadmin/pdf2/IND000031884.2013.A.00.E.03.31.PDF [35] => /home/wvbadmin/pdf2/IND000032147.2013.2U.00.E.06.30.PDF [36] => /home/wvbadmin/pdf2/IND000033884.2012.4U.00.E.12.31.PDF [37] => /home/wvbadmin/pdf2/IND000034072.2013.A.00.E.03.31.PDF [38] => /home/wvbadmin/pdf2/IRL000030033.2013.A.00.E.03.31.PDF [39] => /home/wvbadmin/pdf2/ISR000030527.2013.3.00.L.09.30.PDF [40] => /home/wvbadmin/pdf2/ISR000030655.2011.A.00.L.12.31.PDF [41] => /home/wvbadmin/pdf2/ISR000040085.2013.3.00.L.09.30.PDF [42] => /home/wvbadmin/pdf2/ITA000030188.2013.3.00.L.09.30.PDF [43] => /home/wvbadmin/pdf2/ITA000030409.2013.3.00.L.09.30.PDF [44] => /home/wvbadmin/pdf2/JAM000030049.2013.3.00.E.09.30.PDF [45] => /home/wvbadmin/pdf2/JOR000030234.2013.2.00.L.06.30.PDF [46] => /home/wvbadmin/pdf2/JPN000000697.2013.3.00.L.09.30.PDF [47] => /home/wvbadmin/pdf2/JPN000031875.2013.4.00.L.10.31.PDF [48] => /home/wvbadmin/pdf2/JPN000032495.2013.3N.00.L.09.30.PDF [49] => /home/wvbadmin/pdf2/JPN000033234.2013.2.00.L.06.30.PDF [50] => /home/wvbadmin/pdf2/JPN000033240.2013.2.00.L.06.30.PDF [51] => /home/wvbadmin/pdf2/KOR000040469.2013.3.00.L.09.30.PDF [52] => /home/wvbadmin/pdf2/KOR000041493.2013.1.00.L.03.31.PDF [53] => /home/wvbadmin/pdf2/KOR000041607.2013.1.00.L.03.31.PDF [54] => /home/wvbadmin/pdf2/KWT000030128.2013.3U.00.L.09.30.PDF [55] => /home/wvbadmin/pdf2/LKA000030032.2010.3.00.E.09.30.PDF [56] => /home/wvbadmin/pdf2/MEX000030437.2012.A.00.L.12.31.PDF [57] => /home/wvbadmin/pdf2/MYS000030171.2013.4.00.E.12.31.PDF [58] => /home/wvbadmin/pdf2/MYS000030269.2013.4.00.E.12.31.PDF [59] => /home/wvbadmin/pdf2/MYS000030769.2013.4.00.E.12.31.PDF [60] => /home/wvbadmin/pdf2/MYS000045562.2012.A.00.E.12.31.PDF [61] => /home/wvbadmin/pdf2/MYS000091186.2013.A.00.E.09.30.PDF [62] => /home/wvbadmin/pdf2/NGA000030099.2013.3U.00.E.09.30.PDF [63] => /home/wvbadmin/pdf2/NGA000030110.2008.A.00.E.12.31.PDF [64] => /home/wvbadmin/pdf2/NLD000030099.2013.U.00.E.12.31.PDF [65] => /home/wvbadmin/pdf2/OMN000030055.2013.1.00.E.03.31.PDF [66] => /home/wvbadmin/pdf2/OMN000030099.2013.A.00.E.12.31.PDF [67] => /home/wvbadmin/pdf2/PAK000030059.2013.3.00.E.09.30.PDF [68] => /home/wvbadmin/pdf2/PAN000030138.2012.A.00.L.12.31.PDF [69] => /home/wvbadmin/pdf2/POL000030080.2013.3.00.E.09.30.PDF [70] => /home/wvbadmin/pdf2/POL000040092.2013.A.00.E.12.31.PDF [71] => /home/wvbadmin/pdf2/SGP000030260.2013.4.00.E.10.31.PDF [72] => /home/wvbadmin/pdf2/SGP000030648.2008.1.00.E.03.31.PDF [73] => /home/wvbadmin/pdf2/SWE000040017.2013.1.00.E.03.31.PDF [74] => /home/wvbadmin/pdf2/TTO000030002.2007.A.00.E.12.31.PDF [75] => /home/wvbadmin/pdf2/TUR000030198.2013.1.00.L.03.31.PDF [76] => /home/wvbadmin/pdf2/TWN000030007.2013.3.00.L.09.30.PDF [77] => /home/wvbadmin/pdf2/TWN000030445.2008.A.02.L.12.31.PDF [78] => /home/wvbadmin/pdf2/TWN000030755.2011.A.00.L.12.31.PDF [79] => /home/wvbadmin/pdf2/TWN000031647.2007.2.00.L.06.30.PDF [80] => /home/wvbadmin/pdf2/UGA000030007.2012.A.00.E.12.31.PDF [81] => /home/wvbadmin/pdf2/ZAF000001372.2013.3.00.E.09.30.PDF [82] => /home/wvbadmin/pdf2/ZAF000030068.2013.A.00.E.06.30.PDF [83] => /home/wvbadmin/pdf2/ZAF000030086.2013.A.00.E.08.31.PDF [84] => /home/wvbadmin/pdf2/ZAF000030277.2013.A.00.E.06.30.PDF [85] => /home/wvbadmin/pdf2/ZAF000030504.2012.U.00.E.06.30.PDF [86] => /home/wvbadmin/pdf2/ZMB000030005.2011.1.00.E.03.31.PDF [87] => /home/wvbadmin/pdf2/ZWE000030003.2013.A.00.E.02.28.PDF [88] => /home/wvbadmin/pdf2/ZWE000030037.2013.U.00.E.12.31.PDF [89] => /home/wvbadmin/pdf2/ZWE000030055.2013.A.00.E.09.30.PDF ) Edited May 5, 2014 by Zane Quote Link to comment https://forums.phpfreaks.com/topic/288182-directory-location-question/#findComment-1478247 Share on other sites More sharing options...
mike2 Posted May 5, 2014 Author Share Posted May 5, 2014 Open up a linux console (as a regular user) and run (copy/paste) the following command. php -r 'print_r(glob("/home/wvbadmin/pdf2/*.pdf",true));' What linux distro is that? Is there something in my PHP script that I should change? Quote Link to comment https://forums.phpfreaks.com/topic/288182-directory-location-question/#findComment-1478250 Share on other sites More sharing options...
mike2 Posted May 5, 2014 Author Share Posted May 5, 2014 Open up a linux console (as a regular user) and run (copy/paste) the following command. php -r 'print_r(glob("/home/wvbadmin/pdf2/*.pdf",true));' What linux distro is that? I also took a look at the error logs and the access logs and here is what I discovered: For the error logs I found this error: [Mon May 05 02:46:35 2014] [error] [client 109.91.170.175] Directory index forbidden by Options directive: /var/www/html/ It is obviously not working otherwise I would be able to see the most recent time. Here is the access log: 64.244.240.213 - - [05/May/2014:11:24:05 -0500] "POST /pdfsearch2.php HTTP/1.1" 200 157 "http://64.244.240.221:8080/pdfsearch2.php" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0" Quote Link to comment https://forums.phpfreaks.com/topic/288182-directory-location-question/#findComment-1478252 Share on other sites More sharing options...
jazzman1 Posted May 5, 2014 Share Posted May 5, 2014 (edited) I am on CentOS as well. Next step is to login into a shell as apache user and run the same code. Open up the console again, login as root and then change the shell prompt to apache user. I want to check who has permissions therein. [jazz@centos-box ~]$ su -l root password: [root@centos-box ~]# su - apache -s /bin/bash -bash-4.1$ whoami apache -bash-4.1$ php -r 'print_r(glob("/home/wvbadmin/pdf2/*.PDF",true));' If you get all pdfs as in the example above then you'd need to enable the userDir directive in apache conf file, if not I need to see the output of: ls -la /home/wvbadmin/pdf2/ Edited May 5, 2014 by jazzman1 Quote Link to comment https://forums.phpfreaks.com/topic/288182-directory-location-question/#findComment-1478254 Share on other sites More sharing options...
mike2 Posted May 5, 2014 Author Share Posted May 5, 2014 I am on CentOS as well. Next step is to login into a shell as apache user and run the same code. Open up the console again, login as root and then change the shell prompt to apache user. I want to check who has permissions therein. [jazz@centos-box ~]$ su -l root password: [root@centos-box ~]# su - apache -s /bin/bash -bash-4.1$ whoami apache -bash-4.1$ php -r 'print_r(glob("/home/wvbadmin/pdf2/*.PDF",true));' If you get all pdfs as in the example above then you'd need to enable the userDir directive in apache conf file, if not I need to see the output of: ls -la /home/wvbadmin/pdf2/ Where would my apache configuration file be? I did a yum install of Apache. Plus how would I go about enabling the userDir directive in that Apache configuration file? Here is what I did: [wvbadmin@zeus ~]$ su -l root Password: [root@zeus ~]# su - apache -s /bin/bash -bash-4.1$ whoami apache -bash-4.1$ php -r 'print_r(glob("/home/wvbadmin/pdf2/*.PDF",true));' Array ( [0] => /home/wvbadmin/pdf2/AUS000030444.2013.A.00.E.09.30.PDF [1] => /home/wvbadmin/pdf2/BEL000030189.2011.4U.00.L.12.31.PDF [2] => /home/wvbadmin/pdf2/BGD000030255.2013.A.00.E.06.30.PDF [3] => /home/wvbadmin/pdf2/CAN000031319.2013.3.00.E.09.30.PDF [4] => /home/wvbadmin/pdf2/CAN000033815.2007.3.00.E.07.31.PDF [5] => /home/wvbadmin/pdf2/CAN000034122.2013.A.00.E.09.30.PDF [6] => /home/wvbadmin/pdf2/CAN000034434.2013.A.00.E.09.30.PDF [7] => /home/wvbadmin/pdf2/CHL000030412.2008.3.00.L.09.30.PDF [8] => /home/wvbadmin/pdf2/CHN000040802.2011.A.00.L.12.31.PDF [9] => /home/wvbadmin/pdf2/COL000030189.2008.A.00.L.12.31.PDF [10] => /home/wvbadmin/pdf2/CPV000030004.2012.A.00.L.12.31.PDF [11] => /home/wvbadmin/pdf2/CRI000030034.2005.A.00.L.12.31.PDF [12] => /home/wvbadmin/pdf2/CRI000030039.2009.A.00.L.12.31.PDF [13] => /home/wvbadmin/pdf2/CRI000030049.2009.A.00.L.12.31.PDF [14] => /home/wvbadmin/pdf2/CYM000030017.2013.A.00.E.09.30.PDF [15] => /home/wvbadmin/pdf2/CYM000040027.2012.A.00.L.03.31.PDF [16] => /home/wvbadmin/pdf2/CYM000040323.2007.4.00.E.12.31.PDF [17] => /home/wvbadmin/pdf2/CYP000030004.2013.3.00.E.09.30.PDF [18] => /home/wvbadmin/pdf2/FRA000031191.2012.U.00.L.12.31.PDF [19] => /home/wvbadmin/pdf2/FRA000040051.2011.AMF.00.L.12.31.PDF [20] => /home/wvbadmin/pdf2/GBR000031434.2013.A.00.E.03.31.PDF [21] => /home/wvbadmin/pdf2/GBR000031660.2013.A.00.E.03.31.PDF [22] => /home/wvbadmin/pdf2/GBR000032747.2013.A.00.E.06.30.PDF [23] => /home/wvbadmin/pdf2/GBR000032941.2013.A.00.E.09.30.PDF [24] => /home/wvbadmin/pdf2/GBR000033415.2013.4.00.E.12.31.PDF [25] => /home/wvbadmin/pdf2/GBR000033875.2012.U.00.E.12.02.PDF [26] => /home/wvbadmin/pdf2/GBR000091083.2013.A.00.E.09.30.PDF [27] => /home/wvbadmin/pdf2/HKG000020014.2008.3.00.L.09.30.PDF [28] => /home/wvbadmin/pdf2/HKG000030864.2008.A.00.L.12.31.PDF [29] => /home/wvbadmin/pdf2/HKG000030882.2013.A.00.L.12.31.PDF [30] => /home/wvbadmin/pdf2/HKG000030958.2008.A.00.L.12.31.PDF [31] => /home/wvbadmin/pdf2/HND000030021.2012.L.00.L.12.31.PDF [32] => /home/wvbadmin/pdf2/HUN000040038.2012.A.00.L.12.31.PDF [33] => /home/wvbadmin/pdf2/IDN000030159.2013.A.00.E.12.31.PDF [34] => /home/wvbadmin/pdf2/IND000031884.2013.A.00.E.03.31.PDF [35] => /home/wvbadmin/pdf2/IND000032147.2013.2U.00.E.06.30.PDF [36] => /home/wvbadmin/pdf2/IND000033884.2012.4U.00.E.12.31.PDF [37] => /home/wvbadmin/pdf2/IND000034072.2013.A.00.E.03.31.PDF [38] => /home/wvbadmin/pdf2/IRL000030033.2013.A.00.E.03.31.PDF [39] => /home/wvbadmin/pdf2/ISR000030527.2013.3.00.L.09.30.PDF [40] => /home/wvbadmin/pdf2/ISR000030655.2011.A.00.L.12.31.PDF [41] => /home/wvbadmin/pdf2/ISR000040085.2013.3.00.L.09.30.PDF [42] => /home/wvbadmin/pdf2/ITA000030188.2013.3.00.L.09.30.PDF [43] => /home/wvbadmin/pdf2/ITA000030409.2013.3.00.L.09.30.PDF [44] => /home/wvbadmin/pdf2/JAM000030049.2013.3.00.E.09.30.PDF [45] => /home/wvbadmin/pdf2/JOR000030234.2013.2.00.L.06.30.PDF [46] => /home/wvbadmin/pdf2/JPN000000697.2013.3.00.L.09.30.PDF [47] => /home/wvbadmin/pdf2/JPN000031875.2013.4.00.L.10.31.PDF [48] => /home/wvbadmin/pdf2/JPN000032495.2013.3N.00.L.09.30.PDF [49] => /home/wvbadmin/pdf2/JPN000033234.2013.2.00.L.06.30.PDF [50] => /home/wvbadmin/pdf2/JPN000033240.2013.2.00.L.06.30.PDF [51] => /home/wvbadmin/pdf2/KOR000040469.2013.3.00.L.09.30.PDF [52] => /home/wvbadmin/pdf2/KOR000041493.2013.1.00.L.03.31.PDF [53] => /home/wvbadmin/pdf2/KOR000041607.2013.1.00.L.03.31.PDF [54] => /home/wvbadmin/pdf2/KWT000030128.2013.3U.00.L.09.30.PDF [55] => /home/wvbadmin/pdf2/LKA000030032.2010.3.00.E.09.30.PDF [56] => /home/wvbadmin/pdf2/MEX000030437.2012.A.00.L.12.31.PDF [57] => /home/wvbadmin/pdf2/MYS000030171.2013.4.00.E.12.31.PDF [58] => /home/wvbadmin/pdf2/MYS000030269.2013.4.00.E.12.31.PDF [59] => /home/wvbadmin/pdf2/MYS000030769.2013.4.00.E.12.31.PDF [60] => /home/wvbadmin/pdf2/MYS000045562.2012.A.00.E.12.31.PDF [61] => /home/wvbadmin/pdf2/MYS000091186.2013.A.00.E.09.30.PDF [62] => /home/wvbadmin/pdf2/NGA000030099.2013.3U.00.E.09.30.PDF [63] => /home/wvbadmin/pdf2/NGA000030110.2008.A.00.E.12.31.PDF [64] => /home/wvbadmin/pdf2/NLD000030099.2013.U.00.E.12.31.PDF [65] => /home/wvbadmin/pdf2/OMN000030055.2013.1.00.E.03.31.PDF [66] => /home/wvbadmin/pdf2/OMN000030099.2013.A.00.E.12.31.PDF [67] => /home/wvbadmin/pdf2/PAK000030059.2013.3.00.E.09.30.PDF [68] => /home/wvbadmin/pdf2/PAN000030138.2012.A.00.L.12.31.PDF [69] => /home/wvbadmin/pdf2/POL000030080.2013.3.00.E.09.30.PDF [70] => /home/wvbadmin/pdf2/POL000040092.2013.A.00.E.12.31.PDF [71] => /home/wvbadmin/pdf2/SGP000030260.2013.4.00.E.10.31.PDF [72] => /home/wvbadmin/pdf2/SGP000030648.2008.1.00.E.03.31.PDF [73] => /home/wvbadmin/pdf2/SWE000040017.2013.1.00.E.03.31.PDF [74] => /home/wvbadmin/pdf2/TTO000030002.2007.A.00.E.12.31.PDF [75] => /home/wvbadmin/pdf2/TUR000030198.2013.1.00.L.03.31.PDF [76] => /home/wvbadmin/pdf2/TWN000030007.2013.3.00.L.09.30.PDF [77] => /home/wvbadmin/pdf2/TWN000030445.2008.A.02.L.12.31.PDF [78] => /home/wvbadmin/pdf2/TWN000030755.2011.A.00.L.12.31.PDF [79] => /home/wvbadmin/pdf2/TWN000031647.2007.2.00.L.06.30.PDF [80] => /home/wvbadmin/pdf2/UGA000030007.2012.A.00.E.12.31.PDF [81] => /home/wvbadmin/pdf2/ZAF000001372.2013.3.00.E.09.30.PDF [82] => /home/wvbadmin/pdf2/ZAF000030068.2013.A.00.E.06.30.PDF [83] => /home/wvbadmin/pdf2/ZAF000030086.2013.A.00.E.08.31.PDF [84] => /home/wvbadmin/pdf2/ZAF000030277.2013.A.00.E.06.30.PDF [85] => /home/wvbadmin/pdf2/ZAF000030504.2012.U.00.E.06.30.PDF [86] => /home/wvbadmin/pdf2/ZMB000030005.2011.1.00.E.03.31.PDF [87] => /home/wvbadmin/pdf2/ZWE000030003.2013.A.00.E.02.28.PDF [88] => /home/wvbadmin/pdf2/ZWE000030037.2013.U.00.E.12.31.PDF [89] => /home/wvbadmin/pdf2/ZWE000030055.2013.A.00.E.09.30.PDF ) -bash-4.1$ Quote Link to comment https://forums.phpfreaks.com/topic/288182-directory-location-question/#findComment-1478275 Share on other sites More sharing options...
mike2 Posted May 5, 2014 Author Share Posted May 5, 2014 Where would my apache configuration file be? I did a yum install of Apache. Plus how would I go about enabling the userDir directive in that Apache configuration file? Here is what I did: [wvbadmin@zeus ~]$ su -l root Password: [root@zeus ~]# su - apache -s /bin/bash -bash-4.1$ whoami apache -bash-4.1$ php -r 'print_r(glob("/home/wvbadmin/pdf2/*.PDF",true));' Array ( [0] => /home/wvbadmin/pdf2/AUS000030444.2013.A.00.E.09.30.PDF [1] => /home/wvbadmin/pdf2/BEL000030189.2011.4U.00.L.12.31.PDF [2] => /home/wvbadmin/pdf2/BGD000030255.2013.A.00.E.06.30.PDF [3] => /home/wvbadmin/pdf2/CAN000031319.2013.3.00.E.09.30.PDF [4] => /home/wvbadmin/pdf2/CAN000033815.2007.3.00.E.07.31.PDF [5] => /home/wvbadmin/pdf2/CAN000034122.2013.A.00.E.09.30.PDF [6] => /home/wvbadmin/pdf2/CAN000034434.2013.A.00.E.09.30.PDF [7] => /home/wvbadmin/pdf2/CHL000030412.2008.3.00.L.09.30.PDF [8] => /home/wvbadmin/pdf2/CHN000040802.2011.A.00.L.12.31.PDF [9] => /home/wvbadmin/pdf2/COL000030189.2008.A.00.L.12.31.PDF [10] => /home/wvbadmin/pdf2/CPV000030004.2012.A.00.L.12.31.PDF [11] => /home/wvbadmin/pdf2/CRI000030034.2005.A.00.L.12.31.PDF [12] => /home/wvbadmin/pdf2/CRI000030039.2009.A.00.L.12.31.PDF [13] => /home/wvbadmin/pdf2/CRI000030049.2009.A.00.L.12.31.PDF [14] => /home/wvbadmin/pdf2/CYM000030017.2013.A.00.E.09.30.PDF [15] => /home/wvbadmin/pdf2/CYM000040027.2012.A.00.L.03.31.PDF [16] => /home/wvbadmin/pdf2/CYM000040323.2007.4.00.E.12.31.PDF [17] => /home/wvbadmin/pdf2/CYP000030004.2013.3.00.E.09.30.PDF [18] => /home/wvbadmin/pdf2/FRA000031191.2012.U.00.L.12.31.PDF [19] => /home/wvbadmin/pdf2/FRA000040051.2011.AMF.00.L.12.31.PDF [20] => /home/wvbadmin/pdf2/GBR000031434.2013.A.00.E.03.31.PDF [21] => /home/wvbadmin/pdf2/GBR000031660.2013.A.00.E.03.31.PDF [22] => /home/wvbadmin/pdf2/GBR000032747.2013.A.00.E.06.30.PDF [23] => /home/wvbadmin/pdf2/GBR000032941.2013.A.00.E.09.30.PDF [24] => /home/wvbadmin/pdf2/GBR000033415.2013.4.00.E.12.31.PDF [25] => /home/wvbadmin/pdf2/GBR000033875.2012.U.00.E.12.02.PDF [26] => /home/wvbadmin/pdf2/GBR000091083.2013.A.00.E.09.30.PDF [27] => /home/wvbadmin/pdf2/HKG000020014.2008.3.00.L.09.30.PDF [28] => /home/wvbadmin/pdf2/HKG000030864.2008.A.00.L.12.31.PDF [29] => /home/wvbadmin/pdf2/HKG000030882.2013.A.00.L.12.31.PDF [30] => /home/wvbadmin/pdf2/HKG000030958.2008.A.00.L.12.31.PDF [31] => /home/wvbadmin/pdf2/HND000030021.2012.L.00.L.12.31.PDF [32] => /home/wvbadmin/pdf2/HUN000040038.2012.A.00.L.12.31.PDF [33] => /home/wvbadmin/pdf2/IDN000030159.2013.A.00.E.12.31.PDF [34] => /home/wvbadmin/pdf2/IND000031884.2013.A.00.E.03.31.PDF [35] => /home/wvbadmin/pdf2/IND000032147.2013.2U.00.E.06.30.PDF [36] => /home/wvbadmin/pdf2/IND000033884.2012.4U.00.E.12.31.PDF [37] => /home/wvbadmin/pdf2/IND000034072.2013.A.00.E.03.31.PDF [38] => /home/wvbadmin/pdf2/IRL000030033.2013.A.00.E.03.31.PDF [39] => /home/wvbadmin/pdf2/ISR000030527.2013.3.00.L.09.30.PDF [40] => /home/wvbadmin/pdf2/ISR000030655.2011.A.00.L.12.31.PDF [41] => /home/wvbadmin/pdf2/ISR000040085.2013.3.00.L.09.30.PDF [42] => /home/wvbadmin/pdf2/ITA000030188.2013.3.00.L.09.30.PDF [43] => /home/wvbadmin/pdf2/ITA000030409.2013.3.00.L.09.30.PDF [44] => /home/wvbadmin/pdf2/JAM000030049.2013.3.00.E.09.30.PDF [45] => /home/wvbadmin/pdf2/JOR000030234.2013.2.00.L.06.30.PDF [46] => /home/wvbadmin/pdf2/JPN000000697.2013.3.00.L.09.30.PDF [47] => /home/wvbadmin/pdf2/JPN000031875.2013.4.00.L.10.31.PDF [48] => /home/wvbadmin/pdf2/JPN000032495.2013.3N.00.L.09.30.PDF [49] => /home/wvbadmin/pdf2/JPN000033234.2013.2.00.L.06.30.PDF [50] => /home/wvbadmin/pdf2/JPN000033240.2013.2.00.L.06.30.PDF [51] => /home/wvbadmin/pdf2/KOR000040469.2013.3.00.L.09.30.PDF [52] => /home/wvbadmin/pdf2/KOR000041493.2013.1.00.L.03.31.PDF [53] => /home/wvbadmin/pdf2/KOR000041607.2013.1.00.L.03.31.PDF [54] => /home/wvbadmin/pdf2/KWT000030128.2013.3U.00.L.09.30.PDF [55] => /home/wvbadmin/pdf2/LKA000030032.2010.3.00.E.09.30.PDF [56] => /home/wvbadmin/pdf2/MEX000030437.2012.A.00.L.12.31.PDF [57] => /home/wvbadmin/pdf2/MYS000030171.2013.4.00.E.12.31.PDF [58] => /home/wvbadmin/pdf2/MYS000030269.2013.4.00.E.12.31.PDF [59] => /home/wvbadmin/pdf2/MYS000030769.2013.4.00.E.12.31.PDF [60] => /home/wvbadmin/pdf2/MYS000045562.2012.A.00.E.12.31.PDF [61] => /home/wvbadmin/pdf2/MYS000091186.2013.A.00.E.09.30.PDF [62] => /home/wvbadmin/pdf2/NGA000030099.2013.3U.00.E.09.30.PDF [63] => /home/wvbadmin/pdf2/NGA000030110.2008.A.00.E.12.31.PDF [64] => /home/wvbadmin/pdf2/NLD000030099.2013.U.00.E.12.31.PDF [65] => /home/wvbadmin/pdf2/OMN000030055.2013.1.00.E.03.31.PDF [66] => /home/wvbadmin/pdf2/OMN000030099.2013.A.00.E.12.31.PDF [67] => /home/wvbadmin/pdf2/PAK000030059.2013.3.00.E.09.30.PDF [68] => /home/wvbadmin/pdf2/PAN000030138.2012.A.00.L.12.31.PDF [69] => /home/wvbadmin/pdf2/POL000030080.2013.3.00.E.09.30.PDF [70] => /home/wvbadmin/pdf2/POL000040092.2013.A.00.E.12.31.PDF [71] => /home/wvbadmin/pdf2/SGP000030260.2013.4.00.E.10.31.PDF [72] => /home/wvbadmin/pdf2/SGP000030648.2008.1.00.E.03.31.PDF [73] => /home/wvbadmin/pdf2/SWE000040017.2013.1.00.E.03.31.PDF [74] => /home/wvbadmin/pdf2/TTO000030002.2007.A.00.E.12.31.PDF [75] => /home/wvbadmin/pdf2/TUR000030198.2013.1.00.L.03.31.PDF [76] => /home/wvbadmin/pdf2/TWN000030007.2013.3.00.L.09.30.PDF [77] => /home/wvbadmin/pdf2/TWN000030445.2008.A.02.L.12.31.PDF [78] => /home/wvbadmin/pdf2/TWN000030755.2011.A.00.L.12.31.PDF [79] => /home/wvbadmin/pdf2/TWN000031647.2007.2.00.L.06.30.PDF [80] => /home/wvbadmin/pdf2/UGA000030007.2012.A.00.E.12.31.PDF [81] => /home/wvbadmin/pdf2/ZAF000001372.2013.3.00.E.09.30.PDF [82] => /home/wvbadmin/pdf2/ZAF000030068.2013.A.00.E.06.30.PDF [83] => /home/wvbadmin/pdf2/ZAF000030086.2013.A.00.E.08.31.PDF [84] => /home/wvbadmin/pdf2/ZAF000030277.2013.A.00.E.06.30.PDF [85] => /home/wvbadmin/pdf2/ZAF000030504.2012.U.00.E.06.30.PDF [86] => /home/wvbadmin/pdf2/ZMB000030005.2011.1.00.E.03.31.PDF [87] => /home/wvbadmin/pdf2/ZWE000030003.2013.A.00.E.02.28.PDF [88] => /home/wvbadmin/pdf2/ZWE000030037.2013.U.00.E.12.31.PDF [89] => /home/wvbadmin/pdf2/ZWE000030055.2013.A.00.E.09.30.PDF ) -bash-4.1$ I am on CentOS as well. Next step is to login into a shell as apache user and run the same code. Open up the console again, login as root and then change the shell prompt to apache user. I want to check who has permissions therein. [jazz@centos-box ~]$ su -l root password: [root@centos-box ~]# su - apache -s /bin/bash -bash-4.1$ whoami apache -bash-4.1$ php -r 'print_r(glob("/home/wvbadmin/pdf2/*.PDF",true));' If you get all pdfs as in the example above then you'd need to enable the userDir directive in apache conf file, if not I need to see the output of: ls -la /home/wvbadmin/pdf2/ Disregard the last post. I found the apache configuration file. How would I enable the userDir directive? Quote Link to comment https://forums.phpfreaks.com/topic/288182-directory-location-question/#findComment-1478276 Share on other sites More sharing options...
mike2 Posted May 5, 2014 Author Share Posted May 5, 2014 I am on CentOS as well. Next step is to login into a shell as apache user and run the same code. Open up the console again, login as root and then change the shell prompt to apache user. I want to check who has permissions therein. [jazz@centos-box ~]$ su -l root password: [root@centos-box ~]# su - apache -s /bin/bash -bash-4.1$ whoami apache -bash-4.1$ php -r 'print_r(glob("/home/wvbadmin/pdf2/*.PDF",true));' If you get all pdfs as in the example above then you'd need to enable the userDir directive in apache conf file, if not I need to see the output of: ls -la /home/wvbadmin/pdf2/ I just found where my Apache configuration is found. Would creating a symbolic link work in this situation? If so where would I create the link? Quote Link to comment https://forums.phpfreaks.com/topic/288182-directory-location-question/#findComment-1478281 Share on other sites More sharing options...
mike2 Posted May 5, 2014 Author Share Posted May 5, 2014 I just found where my Apache configuration is found. Would creating a symbolic link work in this situation? If so where would I create the link? I am on CentOS as well. Next step is to login into a shell as apache user and run the same code. Open up the console again, login as root and then change the shell prompt to apache user. I want to check who has permissions therein. [jazz@centos-box ~]$ su -l root password: [root@centos-box ~]# su - apache -s /bin/bash -bash-4.1$ whoami apache -bash-4.1$ php -r 'print_r(glob("/home/wvbadmin/pdf2/*.PDF",true));' If you get all pdfs as in the example above then you'd need to enable the userDir directive in apache conf file, if not I need to see the output of: ls -la /home/wvbadmin/pdf2/ I just went into the Apache configuration file and enabled the UserDir directive and wrote/quit or :wq the file. I tried running pdfsearch2.php and I am still getting that error. Was I supposed to put the word "enabled" at the end of UserDir? Is that the correct edit? I think I may have to create a symbolic link. Quote Link to comment https://forums.phpfreaks.com/topic/288182-directory-location-question/#findComment-1478282 Share on other sites More sharing options...
jazzman1 Posted May 5, 2014 Share Posted May 5, 2014 (edited) Was I supposed to put the word "enabled" at the end of UserDir? Sorry for the delay, busy day... I'm not sure that the problems is there but try, UserDir pdf2 [Mon May 05 02:46:35 2014] [error] [client 109.91.170.175] Directory index forbidden by Options directive: /var/www/html/ Did you make some changes in apache conf file before? Why are you using this extension - .swish-e? Does this extension a part of apache options directive is? What language are you using inside this file index.swish-e? Edited May 5, 2014 by jazzman1 Quote Link to comment https://forums.phpfreaks.com/topic/288182-directory-location-question/#findComment-1478287 Share on other sites More sharing options...
mike2 Posted May 5, 2014 Author Share Posted May 5, 2014 Sorry for the delay, busy day... I'm not sure that the problems is there but try, UserDir pdf2 Did you make some changes in apache conf file before? Why are you using this extension - .swish-e? Does this extension a part of apache options directive is? What language are you using inside this file index.swish-e? Okay let me answer your questions one at a time and in order. I did not make any changes to the apache conf file before other than changing disabled to enabled if you read my previous posts. The reason I am using the .swish-e extenstion is because I have gotten this code from this web page. This is the link http://devzone.zend.com/1591/Indexing-web-content-with-php-swish-e I don't know why that extenstion is there but for some reason it works. index.swish-e is a binary file. It is created when an index is created after you index the PDF files. I put UserDir pdf2 in the /etc/httpd/conf/httpd.conf file and I am still getting: Search ResultsERROR: Could not open the index file '/home/wvbadmin/pdf2/index.swish-e': Permission denied I don't know if that extension is a part of apache options directive. I don't have a lot of PHP experience. Quote Link to comment https://forums.phpfreaks.com/topic/288182-directory-location-question/#findComment-1478292 Share on other sites More sharing options...
jazzman1 Posted May 5, 2014 Share Posted May 5, 2014 Hm...... did you restart apache after changes? /sbin/service httpd restart // as root account Let me see the system permissions to this file, ls -la /home/wvbadmin/pdf2/index.swish-e Can I see the output of: cat /etc/passwd | grep swish // run the string in the console as root account Quote Link to comment https://forums.phpfreaks.com/topic/288182-directory-location-question/#findComment-1478294 Share on other sites More sharing options...
mike2 Posted May 5, 2014 Author Share Posted May 5, 2014 Hm...... did you restart apache after changes? /sbin/service httpd restart // as root account Let me see the system permissions to this file, ls -la /home/wvbadmin/pdf2/index.swish-e Can I see the output of: cat /etc/passwd | grep swish // run the string in the console as root account I restarted Apache. Here is the output for the systems permission to this file: [root@zeus sbin]# ls -la /home/wvbadmin/pdf2/index.swish-e -rw-r--r--. 1 root root 4816366 May 5 11:21 /home/wvbadmin/pdf2/index.swish-e When I typed in your final command, I didn't receive any output. Quote Link to comment https://forums.phpfreaks.com/topic/288182-directory-location-question/#findComment-1478315 Share on other sites More sharing options...
jazzman1 Posted May 6, 2014 Share Posted May 6, 2014 (edited) You need to have "r-read" and "x-execute" permissions to this file to be executable for others group of users like apache for example. Try, chmod 755 /home/wvbadmin/pdf2/index.swish-e When I typed in your final command, I didn't receive any output. I wanted to know if this app was created a special user/group named "swish", but obviously no. Edited May 6, 2014 by jazzman1 Quote Link to comment https://forums.phpfreaks.com/topic/288182-directory-location-question/#findComment-1478320 Share on other sites More sharing options...
mike2 Posted May 6, 2014 Author Share Posted May 6, 2014 You need to have "r-read" and "x-execute" permissions to this file to be executable for others group of users like apache for example. Try, chmod 755 /home/wvbadmin/pdf2/index.swish-e I wanted to know if this app was created a special user/group named "swish", but obviously no. Okay let me give you an update. I made some necessary changes to the Apache configuration file. I changed it back to UserDir disabled because I am still getting permission denied error. I think it may have something to do with my PHP code. Don't know why it isn't working. Also I created a soft link and that still isn't working. Here is what I got: drwxr-xr-x. 2 root root 12288 May 5 21:51 pdf2 lrwxrwxrwx. 1 root root 20 May 5 15:46 pdf3 -> /home/wvbadmin/pdf3/ -rw-r--r--. 1 root root 1214 May 5 23:00 pdfsearch2.php I should mention to you that the same number of PDF files that are in pdf2 are in pdf3. pdf3 is the softlink that links to /home/wvbadmin/pdf3/ I also tried changing the ownership of the pdf files in pdf3 to root but that didn't work. I am still getting the permission denied error. Quote Link to comment https://forums.phpfreaks.com/topic/288182-directory-location-question/#findComment-1478382 Share on other sites More sharing options...
mike2 Posted May 6, 2014 Author Share Posted May 6, 2014 You need to have "r-read" and "x-execute" permissions to this file to be executable for others group of users like apache for example. Try, chmod 755 /home/wvbadmin/pdf2/index.swish-e I wanted to know if this app was created a special user/group named "swish", but obviously no. I don't get why I can't get this to work. It is the exact code for phpsearch.php but all I am doing is just changing the path. Sorry for the delay. Quote Link to comment https://forums.phpfreaks.com/topic/288182-directory-location-question/#findComment-1478383 Share on other sites More sharing options...
mike2 Posted May 6, 2014 Author Share Posted May 6, 2014 You need to have "r-read" and "x-execute" permissions to this file to be executable for others group of users like apache for example. Try, chmod 755 /home/wvbadmin/pdf2/index.swish-e I wanted to know if this app was created a special user/group named "swish", but obviously no. This is the result. I keep getting when I run my pdfsearch2.php script in a web browser: Search ResultsERROR: Could not open the index file '/home/wvbadmin/pdf3/index.swish-e': Permission denied Quote Link to comment https://forums.phpfreaks.com/topic/288182-directory-location-question/#findComment-1478384 Share on other sites More sharing options...
jazzman1 Posted May 6, 2014 Share Posted May 6, 2014 (edited) Why pdf3 instead pdf2? Where the file, named index.swish-e is located? You are making some mess, please don't. Edited May 6, 2014 by jazzman1 Quote Link to comment https://forums.phpfreaks.com/topic/288182-directory-location-question/#findComment-1478389 Share on other sites More sharing options...
mike2 Posted May 6, 2014 Author Share Posted May 6, 2014 Why pdf3 instead pdf2? Where the file, named index.swish-e is located? You are making some mess, please don't. Well actually. Let me tell you why. I was going to do pdf2 but I wanted to test if a soft link would work that is why. index.swish-e is located under /var/www/html/pdf3 and /var/www/html/pdf2. Quote Link to comment https://forums.phpfreaks.com/topic/288182-directory-location-question/#findComment-1478397 Share on other sites More sharing options...
jazzman1 Posted May 6, 2014 Share Posted May 6, 2014 Mike, please, step by step. Can you explain this - Here is the output for the systems permission to this file: [root@zeus sbin]# ls -la /home/wvbadmin/pdf2/index.swish-e -rw-r--r--. 1 root root 4816366 May 5 11:21 /home/wvbadmin/pdf2/index.swish-e How many files with the same name you have in your file structure? Quote Link to comment https://forums.phpfreaks.com/topic/288182-directory-location-question/#findComment-1478400 Share on other sites More sharing options...
mike2 Posted May 6, 2014 Author Share Posted May 6, 2014 Well actually. Let me tell you why. I was going to do pdf2 but I wanted to test if a soft link would work that is why. index.swish-e is located under /var/www/html/pdf3 and /var/www/html/pdf2. Mike, please, step by step. Can you explain this - How many files with the same name you have in your file structure? Okay, Let me try to answer that question as best I can: Under the /home/wvbadmin/pdf2 directory and /home/wvbadmin/pdf3 directory I have the index.swish-e file but under /home/wvbadmin/pdf3 directory index.swish-e is lit up as green indicating it is an executable. I don't know why. Under the /var/www/html directory I have this: -rw-r--r--. 1 root root 6678 Apr 30 13:25 favicon.ico -rw-r--r--. 1 root root 17256 May 5 16:02 h1 -rw-r--r--. 1 root root 113 Apr 29 16:45 hello.php -rw-r--r--. 1 root root 19 Apr 24 23:53 info.php drwxr-xr-x. 2 root root 12288 May 5 21:51 pdf2 lrwxrwxrwx. 1 root root 20 May 5 15:46 pdf3 -> /home/wvbadmin/pdf3/ -rw-r--r--. 1 root root 1214 May 6 11:18 pdfsearch2.php -rw-r--r--. 1 root root 1216 May 6 09:56 pdfsearch.php -rw-r--r--. 1 root root 1838 Apr 30 13:10 search.php Under the /var/www/html/pdf2 directory and /var/www/html/pdf3 directory I have the index.swish-e file but under /var/www/html/pdf3 directory index.swish-e is lit up as green indicating it is an executable. Again I don't know why. Also take into account that pdf3 is being soft linked to the /home/wvbadmin/pdf3 directory which is where I want to get and search my files from if you remember my original question. Quote Link to comment https://forums.phpfreaks.com/topic/288182-directory-location-question/#findComment-1478410 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.