
mike2
Members-
Posts
73 -
Joined
-
Last visited
Everything posted by mike2
-
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.
-
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
-
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.
-
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.
-
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.
-
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.
-
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.
-
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?
-
Disregard the last post. I found the apache configuration file. How would I enable the userDir directive?
-
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 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"
-
Is there something in my PHP script that I should change?
-
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 )
-
The Linux distribution I am using if Linux CentOS 6.5. What is this command going to do?
-
I did that and I am still getting the same permissions denied error.
-
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?
-
Help with getting PDF search results to appear as Hyperlinks
mike2 replied to mike2's topic in PHP Coding Help
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 ResultsERROR: 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. -
Help with getting PDF search results to appear as Hyperlinks
mike2 replied to mike2's topic in PHP Coding Help
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? -
Help with getting PDF search results to appear as Hyperlinks
mike2 replied to mike2's topic in PHP Coding Help
This is what I did: <a href="<?php echo '/pdf2', ltrim($r->swishdocpath, '.') ; ?>"> <?php echo $r->swishdocpath; ?> </a> When I did this I typed in the word test and the PDF files that have the word test in them appear as part of my search results. Not only that but I am now able to open up those PDF files within the search results and I am able to open up those individual PDF files. They now link up to the individual PDF files within the directory where they are stored. Did I really need the swishtitle? -
Help with getting PDF search results to appear as Hyperlinks
mike2 replied to mike2's topic in PHP Coding Help
What exactly are you asking me to do? What is in my original post is the output I type in the word test and what shows up after you hit enter is the list of PDF files that have that word in it. Also what does the page source have to do with the above code telling me that it should already be making a link out of something? -
Help with getting PDF search results to appear as Hyperlinks
mike2 replied to mike2's topic in PHP Coding Help
-
Help with getting PDF search results to appear as Hyperlinks
mike2 replied to mike2's topic in PHP Coding Help
Okay. Do you mean actually show you the link to what I am doing? Here is the link: http://64.244.240.221:8080/pdfsearch.php if you type in test you will get results. also here is the page source when i right clicked and selected page source. <html> <head></head> <body> <h2>Search Results</h2> Found 13 match(es) for 'test'. <p> 1. <strong> <a href="1./ITA000030409.2013.3.00.L.09.30.PDF"> </a> </strong> (score: 1000) <br/> ./ITA000030409.2013.3.00.L.09.30.PDF </p> <p> 2. <strong> <a href="1./POL000040092.2013.A.00.E.12.31.PDF"> </a> </strong> (score: 737) <br/> ./POL000040092.2013.A.00.E.12.31.PDF </p> <p> 3. <strong> <a href="1./ISR000030655.2011.A.00.L.12.31.PDF"> </a> </strong> (score: 737) <br/> ./ISR000030655.2011.A.00.L.12.31.PDF </p> <p> 4. <strong> <a href="1./SWE000040017.2013.1.00.E.03.31.PDF"> </a> </strong> (score: 680) <br/> ./SWE000040017.2013.1.00.E.03.31.PDF </p> <p> 5. <strong> <a href="1./ZAF000030086.2013.A.00.E.08.31.PDF"> </a> </strong> (score: 680) <br/> ./ZAF000030086.2013.A.00.E.08.31.PDF </p> <p> 6. <strong> <a href="1./FRA000040051.2011.AMF.00.L.12.31.PDF"> </a> </strong> (score: 608) <br/> ./FRA000040051.2011.AMF.00.L.12.31.PDF </p> <p> 7. <strong> <a href="1./ZAF000030068.2013.A.00.E.06.30.PDF"> </a> </strong> (score: 608) <br/> ./ZAF000030068.2013.A.00.E.06.30.PDF </p> <p> 8. <strong> <a href="1./IRL000030033.2013.A.00.E.03.31.PDF"> </a> </strong> (score: 524) <br/> ./IRL000030033.2013.A.00.E.03.31.PDF </p> <p> 9. <strong> <a href="1./ZAF000030504.2012.U.00.E.06.30.PDF"> </a> </strong> (score: 524) <br/> ./ZAF000030504.2012.U.00.E.06.30.PDF </p> <p> 10. <strong> <a href="1./MYS000091186.2013.A.00.E.09.30.PDF"> </a> </strong> (score: 524) <br/> ./MYS000091186.2013.A.00.E.09.30.PDF </p> <p> 11. <strong> <a href="1./ZWE000030003.2013.A.00.E.02.28.PDF"> </a> </strong> (score: 414) <br/> ./ZWE000030003.2013.A.00.E.02.28.PDF </p> <p> 12. <strong> <a href="1./CAN000031319.2013.3.00.E.09.30.PDF"> </a> </strong> (score: 414) <br/> ./CAN000031319.2013.3.00.E.09.30.PDF </p> <p> 13. <strong> <a href="1./NGA000030110.2008.A.00.E.12.31.PDF"> </a> </strong> (score: 262) <br/> ./NGA000030110.2008.A.00.E.12.31.PDF </p> </body> </html> -
Help with getting PDF search results to appear as Hyperlinks
mike2 posted a topic in PHP Coding Help
To whom it may concern: I have this code that was written and basically what I am trying to do is get my search results (which are PDF files by the way) to be displayed as links to those particular PDF files as the pertain to the PDF files themselves. Here is the code: <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('/var/www/html/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 $r->swishdocpath; ?>"> <?php echo $r->swishtitle; ?> </a> </strong> (score: <?php echo $r->swishrank; ?>) <br/> <?php echo $r->swishdocpath; ?> </p> <?php } } catch (Exception $e) { die('ERROR: ' . $e->getMessage()); } } ?> </body> </html> What this code does is it goes to the pdfsearch.php web page and it displays a Search box with a search field. The user then enters a word to search for words that are stored within those PDF files and the PDFs that have said word or words are diplayed: Here is an example: Let's say I am searching for the word test. Search ResultsFound 13 match(es) for 'test' . 1. (score: 1000) ./ITA000030409.2013.3.00.L.09.30.PDF 2. (score: 737) ./POL000040092.2013.A.00.E.12.31.PDF 3. (score: 737) ./ISR000030655.2011.A.00.L.12.31.PDF 4. (score: 680) ./SWE000040017.2013.1.00.E.03.31.PDF 5. (score: 680) ./ZAF000030086.2013.A.00.E.08.31.PDF 6. (score: 608) ./FRA000040051.2011.AMF.00.L.12.31.PDF 7. (score: 608) ./ZAF000030068.2013.A.00.E.06.30.PDF 8. (score: 524) ./IRL000030033.2013.A.00.E.03.31.PDF 9. (score: 524) ./ZAF000030504.2012.U.00.E.06.30.PDF 10. (score: 524) ./MYS000091186.2013.A.00.E.09.30.PDF 11. (score: 414) ./ZWE000030003.2013.A.00.E.02.28.PDF 12. (score: 414) ./CAN000031319.2013.3.00.E.09.30.PDF 13. (score: 262) ./NGA000030110.2008.A.00.E.12.31.PDF My question is what would I have to do to my PHP code so that the search results of the PDF files themselves are able to be linked to each of their prospective PDF files individually so that when a user clicks on an individual PDF link, that individual PDF appears? The directory where the PDF files are stored is located under the /var/www/html/pdf2 directory. If anyone could assist me in this project I would greatly appreciate it.