mike2 Posted May 6, 2014 Author Share Posted May 6, 2014 Mike, please, step by step. Can you explain this - How many files with the same name you have in your file structure? Did you mean files with the same name as index.swish-e? Quote Link to comment Share on other sites More sharing options...
mike2 Posted May 6, 2014 Author Share Posted May 6, 2014 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. As you can see pdfsearch2.php is what I am trying to run but is giving me a permission error. phpsearch.php works correctly and does its function but what I am trying to do is get pdfsearch2.php to work the same way as pdfsearch.php but search files that are in the /home/wvbadmin/pdf3 directory. Quote Link to comment Share on other sites More sharing options...
mike2 Posted May 6, 2014 Author Share Posted May 6, 2014 (edited) 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. Are there any changes I can make to the Apache configuration file that would be get this problem resolved? I would like to resolve this issue as soon as possible. Edited May 6, 2014 by mike2 Quote Link to comment Share on other sites More sharing options...
gizmola Posted May 6, 2014 Share Posted May 6, 2014 Do you have Options +FollowSymLinks Enabled in your apache config or htaccess in some appropriate place? Symlinks won't work in apache with that at very least. If you're running mod_php, php has to play by the rules of apache. Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted May 6, 2014 Share Posted May 6, 2014 (edited) This your script - $swish = new Swish('/home/wvbadmin/pdf2/index.swish-e'); Re-read my 2 and 18 replies! Edited May 6, 2014 by jazzman1 Quote Link to comment Share on other sites More sharing options...
mike2 Posted May 6, 2014 Author Share Posted May 6, 2014 Do you have Options +FollowSymLinks Enabled in your apache config or htaccess in some appropriate place? Symlinks won't work in apache with that at very least. If you're running mod_php, php has to play by the rules of apache. Here is what I have in my Apache configuration file. # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.2/mod/core.html#options # for more information. # Options Indexes FollowSymLinks Should the above be changed to Options +FollowSymLinks? Is that what you are asking/do? Also Here is what I have in the Apache configuration file as far as htaccess # # AccessFileName: The name of the file to look for in each directory # for additional configuration directives. See also the AllowOverride # directive. # AccessFileName .htaccess Plus # # UserDir is disabled by default since it can confirm the presence # of a username on the system (depending on home directory # permissions). # UserDir disabled Should the above be changed to UserDir pdf3? Since that is where we are searching from? What do you mean by mod_php? This is the version I am running. [root@zeus conf]# rpm -q php php-5.3.3-27.el6_5.x86_64 Quote Link to comment Share on other sites More sharing options...
mike2 Posted May 6, 2014 Author Share Posted May 6, 2014 This your script - $swish = new Swish('/home/wvbadmin/pdf2/index.swish-e'); Re-read my 2 and 18 replies! I will give those a try and let you know what the outcome is. Quote Link to comment Share on other sites More sharing options...
mike2 Posted May 6, 2014 Author Share Posted May 6, 2014 This your script - $swish = new Swish('/home/wvbadmin/pdf2/index.swish-e'); Re-read my 2 and 18 replies! I redid what you told me to do in your 2nd reply. I am still getting the same error. Permissions denied. Should I restart apache? I did the following: su -c 'chmod 755 /home/wvbadmin/ -R' Should I now do what you told me to do reply number 18? Quote Link to comment Share on other sites More sharing options...
mike2 Posted May 6, 2014 Author Share Posted May 6, 2014 I will give those a try and let you know what the outcome is. I did them both and I am still getting: Search ResultsERROR: Could not open the index file '/home/wvbadmin/pdf3/index.swish-e': Permission denied when I go to http://64.244.240.221:8080/pdfsearch2.php and enter in the word bank in the search engine and nothing shows up. Just the above message. I even tried going into the apache config file and changed UserDir to /pdf3 and it is still not working. I am starting to lose my patience. I just want to search from the /home/wvbadmin/pdf3 directory. I should be able to run this. Quote Link to comment Share on other sites More sharing options...
gizmola Posted May 6, 2014 Share Posted May 6, 2014 Do you understand how symlinks work? It doesn't matter what the symlink permissions are, if the underlying directory permissions won't allow access. Also if apache doesn't allow access to the files or directory, you're going to get these permissions errors. It's an apache config problem. Also fwiw, with mod_apache... yes you have to restart apache anytime you change an apache configuration item or a php configuration item. Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted May 6, 2014 Share Posted May 6, 2014 (edited) Why did you call "/home/wvbadmin/pdf3/index.swish-e" when we're talking about "/home/wvbadmin/pdf2/index.swish-e". If you want to call "/home/wvbadmin/pdf3/index.swish-e" then you are providing us wrong script in your first reply! Can you post the script of pdfsearch2.php. Edited May 6, 2014 by jazzman1 Quote Link to comment Share on other sites More sharing options...
mike2 Posted May 6, 2014 Author Share Posted May 6, 2014 Why did you call "/home/wvbadmin/pdf3/index.swish-e" when we're talking about "/home/wvbadmin/pdf2/index.swish-e". If you want to call "/home/wvbadmin/pdf3/index.swish-e" then you are providing us wrong script in your first reply! Can you post the script of pdfsearch2.php. My apoligies here is the updated pdfsearch2.php script: <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/pdf3/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 '/pdf3', 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> Quote Link to comment Share on other sites More sharing options...
mike2 Posted May 6, 2014 Author Share Posted May 6, 2014 Do you understand how symlinks work? It doesn't matter what the symlink permissions are, if the underlying directory permissions won't allow access. Also if apache doesn't allow access to the files or directory, you're going to get these permissions errors. It's an apache config problem. Also fwiw, with mod_apache... yes you have to restart apache anytime you change an apache configuration item or a php configuration item. To answer your question about soft links and how they work. Don't they link up to a another directory? I also restarted Apache and I am still getting permission denied. I understand that is either an apache config problem or something with my code. It shouldn't be my code. My code should be doing what it is supposed to be doing. Quote Link to comment Share on other sites More sharing options...
mike2 Posted May 6, 2014 Author Share Posted May 6, 2014 Why did you call "/home/wvbadmin/pdf3/index.swish-e" when we're talking about "/home/wvbadmin/pdf2/index.swish-e". If you want to call "/home/wvbadmin/pdf3/index.swish-e" then you are providing us wrong script in your first reply! Can you post the script of pdfsearch2.php. Here is also what is inside my /var/www/html directory if it's any help. [root@zeus html]# ls -l total 60 -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 Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted May 6, 2014 Share Posted May 6, 2014 Then, do su -c 'chmod 755 /home/wvbadmin/pdf3/index.swish-e' and everything should work as expected. Quote Link to comment Share on other sites More sharing options...
mike2 Posted May 6, 2014 Author Share Posted May 6, 2014 Do you understand how symlinks work? It doesn't matter what the symlink permissions are, if the underlying directory permissions won't allow access. Also if apache doesn't allow access to the files or directory, you're going to get these permissions errors. It's an apache config problem. Also fwiw, with mod_apache... yes you have to restart apache anytime you change an apache configuration item or a php configuration item. Then, do su -c 'chmod 755 /home/wvbadmin/pdf3/index.swish-e' and everything should work as expected. I did just that and I am still getting permission error. One more thing that I want to mention is that I have never even used php code before. This is my first time and I just to be able to get this phase of my project done before I move on the next phase. If I were to change the location of the DocumentRoot from /var/www/html to /home/wvbadmin would that be of assistance or does the Apache config file need to be pointed at /var/www/html? Quote Link to comment Share on other sites More sharing options...
mike2 Posted May 6, 2014 Author Share Posted May 6, 2014 Then, do su -c 'chmod 755 /home/wvbadmin/pdf3/index.swish-e' and everything should work as expected. Can the Apache configuration file have multiple document roots? Quote Link to comment Share on other sites More sharing options...
mike2 Posted May 6, 2014 Author Share Posted May 6, 2014 Can the Apache configuration file have multiple document roots? Furthermore since none of the permission changes seem to be working, may I change them back to their original permission settings? Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted May 6, 2014 Share Posted May 6, 2014 Same error? Can I see the output of - ls -la /home/wvbadmin/pdf3/index.swish-e Quote Link to comment Share on other sites More sharing options...
gizmola Posted May 6, 2014 Share Posted May 6, 2014 To answer your question about soft links and how they work. Don't they link up to a another directory? I also restarted Apache and I am still getting permission denied. I understand that is either an apache config problem or something with my code. It shouldn't be my code. My code should be doing what it is supposed to be doing. The point about restarting apache addresses your question from before. Yeah you have to restart apache anytime you change something while trying to debug this. A symlink is a file, as is everything in the unix filesystem. Of course some files can be directories. What is special about a symbolic link is that it points to something else, so yes you are right. However, what I was telling you is that if i have a directory like this: [david@penny apple]$ ls -lath total 8.0K drwxrwxr-x 2 david david 4.0K May 6 12:40 . --w--w---- 1 david david 0 May 6 12:40 macintosh.txt drwxrwxr-x 3 david david 4.0K May 6 12:39 .. [david@penny apple]$ cat macintosh.txt cat: macintosh.txt: Permission denied As you can see, I have a directory with one file in it that only has write permissions for user/group. I try and read that file using cat, it doesn't allow it. Now I make a symlink to that file: [david@penny apple]$ ln -s macintosh.txt symlink_to_mac.txt [david@penny apple]$ ls -lath total 8.0K drwxrwxr-x 2 david david 4.0K May 6 12:42 . lrwxrwxrwx 1 david david 13 May 6 12:42 symlink_to_mac.txt -> macintosh.txt --w--w---- 1 david david 0 May 6 12:40 macintosh.txt drwxrwxr-x 3 david david 4.0K May 6 12:39 .. [david@penny apple]$ cat symlink_to_mac.txt cat: symlink_to_mac.txt: Permission denied When I make a symlink it shows as having full 777 access, but the underlying file is still not accessible, because the permissions on that file are not ones that allow me to access the file. You can not change the perms on a symlink as they are basically irrelevant. As you stated, they point to the underlying file or directory, and those permissions are important. The user apache is running as, also needs to be able to access the directory and its files if apache is going to read them. Quote Link to comment Share on other sites More sharing options...
mike2 Posted May 6, 2014 Author Share Posted May 6, 2014 Same error? Can I see the output of - ls -la /home/wvbadmin/pdf3/index.swish-e Here is output: [root@zeus conf]# ls -la /home/wvbadmin/pdf3/index.swish-e -rw-r--r--. 1 root root 4816366 May 5 23:32 /home/wvbadmin/pdf3/index.swish-e Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted May 6, 2014 Share Posted May 6, 2014 Why you (root) are not able to change permissions to this file. Try the following and give me back the output su -c 'chmod --verbose 755 /home/wvbadmin/pdf3/index.swish-e' Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted May 8, 2014 Share Posted May 8, 2014 (edited) I installed in my centos machine just for testing purpose this API. So, I was able to index all searchable html files locating in directories out of apache home directory. Here it's my attempt, swish-e.conf IndexDir /home/lxc/public_html /var/www/html/tests IndexOnly .html .htm FuzzyIndexingMode Stemming_en1 [lxc@localhost pdo]$ /usr/local/bin/swish-e -c swish-e.conf Indexing Data Source: "File-System" Indexing "/home/lxc/public_html" Indexing "/var/www/html/tests" Removing very common words... no words removed. Writing main index... Sorting words ... Sorting 1 words alphabetically Writing header ... Writing index entries ... Writing word text: Complete Writing word hash: Complete Writing word data: Complete 1 unique word indexed. 4 properties sorted. 4 files indexed. 5 total bytes. 1 total words. Elapsed time: 00:00:00 CPU time: 00:00:00 Indexing done! My apache home dir in this system (if it matters at all) is /www/htdocs. I ran the command from the linux shell following the guide you've been posted before - http://devzone.zend.com/1591/indexing-web-content-with-php-and-swish-e/ Edited May 8, 2014 by jazzman1 Quote Link to comment Share on other sites More sharing options...
mike2 Posted May 12, 2014 Author Share Posted May 12, 2014 I installed in my centos machine just for testing purpose this API. So, I was able to index all searchable html files locating in directories out of apache home directory. Here it's my attempt, swish-e.conf IndexDir /home/lxc/public_html /var/www/html/tests IndexOnly .html .htm FuzzyIndexingMode Stemming_en1 [lxc@localhost pdo]$ /usr/local/bin/swish-e -c swish-e.conf Indexing Data Source: "File-System" Indexing "/home/lxc/public_html" Indexing "/var/www/html/tests" Removing very common words... no words removed. Writing main index... Sorting words ... Sorting 1 words alphabetically Writing header ... Writing index entries ... Writing word text: Complete Writing word hash: Complete Writing word data: Complete 1 unique word indexed. 4 properties sorted. 4 files indexed. 5 total bytes. 1 total words. Elapsed time: 00:00:00 CPU time: 00:00:00 Indexing done! My apache home dir in this system (if it matters at all) is /www/htdocs. I ran the command from the linux shell following the guide you've been posted before - http://devzone.zend.com/1591/indexing-web-content-with-php-and-swish-e/ Forgive the lateness of my reply. But things have changed I will let you know what has happened. Quote Link to comment Share on other sites More sharing options...
mike2 Posted May 12, 2014 Author Share Posted May 12, 2014 (edited) I installed in my centos machine just for testing purpose this API. So, I was able to index all searchable html files locating in directories out of apache home directory. Here it's my attempt, swish-e.conf IndexDir /home/lxc/public_html /var/www/html/tests IndexOnly .html .htm FuzzyIndexingMode Stemming_en1 [lxc@localhost pdo]$ /usr/local/bin/swish-e -c swish-e.conf Indexing Data Source: "File-System" Indexing "/home/lxc/public_html" Indexing "/var/www/html/tests" Removing very common words... no words removed. Writing main index... Sorting words ... Sorting 1 words alphabetically Writing header ... Writing index entries ... Writing word text: Complete Writing word hash: Complete Writing word data: Complete 1 unique word indexed. 4 properties sorted. 4 files indexed. 5 total bytes. 1 total words. Elapsed time: 00:00:00 CPU time: 00:00:00 Indexing done! My apache home dir in this system (if it matters at all) is /www/htdocs. I ran the command from the linux shell following the guide you've been posted before - http://devzone.zend.com/1591/indexing-web-content-with-php-and-swish-e/ I don't know if you are still online right now but I think I may know what the issue is. The server contains a 1.5 TB drive which is partitioned by lvm. The partitions created on this server are all on the same physical drive but different logical volumes. For example the /home directory resides under the /vg_zeus-lv_home device name. The apache is installed at the device named /vg_zeus-lv_root. The issue is related to apache and /home/wvbadmin directories residing on seperate logical volumes. Would the following scenario work to give me the results I need for my pdfsearch2.php script to give the same results as pdfsearch.php script under the /var/www/html directory? Now keep in mind that I copied everything over from /var/www/html directory to /mnt/www/html directory. This is what is inside /mnt/www/html directory: total 48 -rw-r--r--. 1 root root 6678 May 8 14:33 favicon.ico -rw-r--r--. 1 root root 113 May 8 14:33 hello.php -rw-r--r--. 1 root root 19 May 8 14:33 info.php drwxr-xr-x. 2 root root 4096 May 8 14:35 pdf2 -rw-r--r--. 1 root root 1228 May 8 14:44 pdfsearch2.php -rw-r--r--. 1 root root 1204 May 8 14:33 pdfsearch3.php -rw-r--r--. 1 root root 1216 May 12 11:35 pdfsearch.php -rw-r--r--. 1 root root 1838 May 8 14:33 search.php -rw-r--r--. 1 root root 10077 May 8 15:24 wvb-logo-slogen.png Here is the following scenario: Scenario 1: Configure apache so that the htdocs root is located under the /home directory. We might create a user "www" to be the owner of htdocs. This would then place both htdocs and pdf directories under the same logical volume. How would I go about doing the above scenrio? Where in the apache config file is htdocs? Would that work? Edited May 12, 2014 by mike2 Quote Link to comment 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.