Re: [PHP] Error accessing class
Hi Tyler, Thank you, I checked the permissions and the ownership, all ok, but by inserting the absolute path in the page, the code is running and get the expected output from the script. I realized that I made the same mistake in the php.ini file, I updated the include_path statement to include_path = ".:/var/www/htmls/php/includes" and now can simply reference the class file without the path and it is working fine. One question, what is the significance of the colon (:) in the include_path directive? Thanks, Andrew [EMAIL PROTECTED] wrote: >Hi Andrew, > >This error indicates that your path to class.Htpasswd.php3 is wrong. >use this: >include("path/to/class.Htpasswd.php3"); > >Right now, it's set to look in the php/includes dir. If the file is >actually in there, then apache might not have perms to read the file (IE: >it's owned by root). > >Good luck, >Tyler Longren >Captain Jack Communications >www.captainjack.com >[EMAIL PROTECTED] > >- Original Message - >From: "Andrew Schoenherr" <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> >Sent: Saturday, April 13, 2002 12:54 AM >Subject: [PHP] Error accessing class > > >>Hello, >> >>PHP Version: 4.1.0, Apache Version: 1.3.12, Server: Linux 7.0 >>Class name: class.Htpasswd.php3 >> >>Thanks to Jason Wong for pointers on posting to the list, the parse >>error was a simple omission of a quotation mark on my part. >> >>This is the error I am getting... >> >>Warning: Failed opening 'class.Htpasswd.php3' for inclusion >>(include_path='.:/php/includes') in /var/www/html/php/dev/valid_user.php >>on line 9 >> >>Fatal error: Cannot instantiate non-existent class: htpasswd in >>/var/www/html/php/dev/valid_user.php on line 10 >> >>7 >>8 >9 include("class.Htpasswd.php3"); >>10 $aHTPasswd = new Htpasswd("/var/www/html/private/.htpassd"); >>11 if (!$aHTPasswd->EXISTS) >>12 { >>13 print("authentication error); >>14 } >>15 else >>16 { >>17if ( $aHTPasswd->verifyUser( "phpbook", "phpbook" ) ) >>18{ >>19 print( "phpbook is a valid user" ); >>20} >>21else >>22{ >>23 print( "phpbook is not a valid user" ); >>24} >>25 } >>26 ?> >>27 >>28 >> >>Any ideas on the error? >> >>Thank you, >> >>Regards, >> >>Andrew Schoenherr >> >> >>-- >>PHP General Mailing List (http://www.php.net/) >>To unsubscribe, visit: http://www.php.net/unsub.php >> > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Error accessing class
Hello, PHP Version: 4.1.0, Apache Version: 1.3.12, Server: Linux 7.0 Class name: class.Htpasswd.php3 Thanks to Jason Wong for pointers on posting to the list, the parse error was a simple omission of a quotation mark on my part. This is the error I am getting... Warning: Failed opening 'class.Htpasswd.php3' for inclusion (include_path='.:/php/includes') in /var/www/html/php/dev/valid_user.php on line 9 Fatal error: Cannot instantiate non-existent class: htpasswd in /var/www/html/php/dev/valid_user.php on line 10 7 8 EXISTS) 12 { 13 print("authentication error); 14 } 15 else 16 { 17if ( $aHTPasswd->verifyUser( "phpbook", "phpbook" ) ) 18{ 19 print( "phpbook is a valid user" ); 20} 21else 22{ 23 print( "phpbook is not a valid user" ); 24} 25 } 26 ?> 27 28 Any ideas on the error? Thank you, Regards, Andrew Schoenherr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parse Error using an include class
Hello, This is my first question to the list, I have included as much information as I feel will help someone find a solution to my problem. Server: RedHat Linux 7.0, Kernel 2.2.16-22 PHP Version: 4.1.0 Apache Version: 1.3.12 Class name: class.Htpasswd.php3 Problem I have just started using classes, downloaded from www.thewebmasters.net web site. I am working on user authentication and I am getting a parse error when the page loads. Only since I started using the class has this parse error occurred, but I am not sure if it the class that is causing the problem or not. I have included sections that I feel are relevant from my httpd.conf, php.ini and locations and contents of my .htpasswd files. File Locations: php config script - php.ini - /usr/local/lib/php.ini password flat file - .htpasswd - /var/www/html/private/.htpasswd include directory - - /var/www/html/php/includes include class name - class.Htpasswd.php3 ** start php file to validate user * Quick Validate Using Htpasswd Class EXISTS) { print("authentication error); } else { // try to debug by printing to the screen // echo( "passes check for aHTPasswd->EXITS"); if ( $aHTPasswd->verifyUser( "phpbook", "phpbook" ) ) { print( "phpbook is a valid user" ); } else { print( "phpbook is not a valid user" ); } } ?> ** end php file to validate user * The following is from my http.conf file. ** start section of httpd.conf file * ### Section 1: Global Environment ServerType standalone ServerRoot "/etc/httpd" Port 80 User apache Group apache ServerAdmin andrew@fremont ServerName 192.168.2.2 DocumentRoot "/var/www/html" Options FollowSymLinks AllowOverride None Options Indexes Includes FollowSymLinks # Changed 4-5-02 AllowOverride Limit # Changed 4-2-02 AllowOverride All #AllowOverride None AllowOverride Limit # # Controls who can get stuff from this server. # Order allow,deny Allow from all ** end section of httpd.conf file * My php.ini file listing all directives, include towards the end. ** start php.ini file * engine = On short_open_tag = On asp_tags = Off precision= 14 y2k_compliance = Off output_buffering = Off output_handler = zlib.output_compression = Off implicit_flush = Off allow_call_time_pass_reference = On safe_mode = Off safe_mode_gid = Off safe_mode_include_dir = safe_mode_exec_dir = safe_mode_allowed_env_vars = PHP_ safe_mode_protected_env_vars = LD_LIBRARY_PATH disable_functions = highlight.string = #CC highlight.comment = #FF9900 highlight.keyword = #006600 highlight.bg = #FF highlight.default = #CC highlight.html= #00 max_execution_time = 30 ; Maximum execution time of each script, in seconds memory_limit = 8M ; Maximum amount of memory a script may consume (8MB) error_reporting = E_ALL & ~E_NOTICE display_errors = On display_startup_errors = Off log_errors = Off track_errors = Off warn_plus_overloading = Off include_path = ".:/php/includes" doc_root = user_dir = extension_dir = ./ enable_dl = On file_uploads = On upload_max_filesize = 2M ** end php.ini file * Here is the details from my .htaccess file that I have installed inside the folder I want protected. The user ahelis has been added to the ../../private/.htpasswd successfully. ** start .htaccess file * AuthUserFile ../../private/.htpasswd AuthGroupFile /dev/null AuthName ByPassword AuthType Basic require ahelis ** end .htaccess file * On a side note, if someone can check my .htaccess permissions as compared to the directives set in my httpd.conf file, I would appreciate knowing if I have other problems. I hope the solution is something that I have over looked or miss configured. Any assistance is appreciated. Andrew Schoenherr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php