i was having fun with php until i hit this road block...

geolocation.class.php is in the same directory as my index.php.. anyone has any idea why it can't find it? =(

/*
* this is part of the index.php
* /

<div id="midBox">
    	<table border="0" align="left">
        	<tr><td><script type="text/javascript">
						var date= new Date();
						document.write(date);
                    </script>
			    </td>
			</tr>
            <tr><td><?php $visitorIP= $_SERVER['REMOTE_ADDR']; echo "Your IP is: " .$visitorIP;  ?></td></tr>
            <tr><td><?php include('geolocation.class.php') or die(); // not found
 
						//Load the class (city precision)
						$geolocation = new geolocation(true);

					?>
                </td>
            </tr>
        
        </table>
    
    </div>

error message

Warning: include(1) [function.include]: failed to open stream: No such file or directory in C:\wamp\www\index.php  on line 58

Warning: include() [function.include]: Failed opening '1' for inclusion (include_path='.://C:/wamp/www') in C:\wamp\www\index.php on line 58

Fatal error: Class 'geolocation' not found in C:\wamp\www\index.php on line 61

It seems your geolocation.class.php page is not there in the same directory

check where is it located and give correct path in your include to load the geolocation.class

ex:
include('somedirectorypath/geolocation.class');

or

include('../somedirectorypath/geolocation.class');

i was having fun with php until i hit this road block...

geolocation.class.php is in the same directory as my index.php.. anyone has any idea why it can't find it? =(

/*
* this is part of the index.php
* /

<div id="midBox">
    	<table border="0" align="left">
        	<tr><td><script type="text/javascript">
						var date= new Date();
						document.write(date);
                    </script>
			    </td>
			</tr>
            <tr><td><?php $visitorIP= $_SERVER['REMOTE_ADDR']; echo "Your IP is: " .$visitorIP;  ?></td></tr>
            <tr><td><?php include('geolocation.class.php') or die(); // not found
 
						//Load the class (city precision)
						$geolocation = new geolocation(true);

					?>
                </td>
            </tr>
        
        </table>
    
    </div>

error message

Warning: include(1) [function.include]: failed to open stream: No such file or directory in C:\wamp\www\index.php  on line 58

Warning: include() [function.include]: Failed opening '1' for inclusion (include_path='.://C:/wamp/www') in C:\wamp\www\index.php on line 58

Fatal error: Class 'geolocation' not found in C:\wamp\www\index.php on line 61

the class file is there... i still don't understand why php gives me the error message. it actually finds it.. it is just the "or die()" pops the not found message.

It will be there, but it is not there in the right path

ex:

index.php
files2/class1.php
files1/class2.php

when index.php is executing, if you want to include files2/class1.php

include('files2/class1.php')

when index.php is executing, if you want to include files1/class2.php

include('files1/class2.php')


the class file is there... i still don't understand why php gives me the error message. it actually finds it.. it is just the "or die()" pops the not found message.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.