Solved

Problem setting up php on apache

Posted on 2002-05-14
18
303 Views
Last Modified: 2010-05-18
I have set up apache and php on a win 98 machine, the problem i have is this when i call a php script i get this error message

Warning: Failed opening '/home/tkit/web/index.php' for inclusion (include_path='c:\php4\includes') in Unknown on line 0

the contens of index.php is as follows


<?phpinfo()?>

hmm what have i done wrong

thanks kieran
0
Comment
Question by:kplonk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 11
  • 6
18 Comments
 
LVL 15

Expert Comment

by:samri
ID: 7010052
> Warning: Failed opening '/home/tkit/web/index.php' for inclusion (include_path='c:\php4\includes') in Unknown on line 0

One simple question: Does the file exist (/home/tkit/web/index.php).  I would presume that your platform is Win98, and the path still looks like a Unix path to me.

I am not that familiar with PHP, perhaps, could you try with a simpler PHP code, let say to display "Hello World".  This may look stupid, but at least we need to narrow down, whether it is the server problem, PHP problem, or the code itself.

cheers.

0
 

Author Comment

by:kplonk
ID: 7010638
Ok did try that <? echo "hello" ?> also no joy

the setup of apache on win 98 requires // rathere than \\ seems odd but the rest works for example normal pages and shtml is all st up and woring, is mor information needed .conf and php.ini can post here if required??

thanks -k-
0
 

Author Comment

by:kplonk
ID: 7010647
Just a thought as I see it php is trrying to include the index.php file but seems unable to do this, as it is is not in c:\php4\includes it is in c:\home\tkit\web\ i think the problem may be script aliasing in the apache config, i am running several vhosts?? does this help??

thanks -k-
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 15

Expert Comment

by:samri
ID: 7010677
kplonk,

Yes the information is very helpful.

Please check your apache logfile.  In most cases it would be "C:\Program Files\Apache Group\Apache\logs\error.log", perhaps the last few lines.

Another thing, please read the "install.txt" files that comes with PHP Packages.  There are a few lines needs to be added to the httpd.conf as weel.  Personally, I have tried it (go thru step by step, and it should be working).

Some of the things, that need to be modified in httpd.conf would include:
1. httpd.conf
#LoadModule php4_module modules/php4apache.dll
#AddModule mod_php4.c
#    AddType application/x-httpd-php .php
#    AddType application/x-httpd-php-source .phps

2. copy the dll in sapi directory to "\program files\apache group\apache\modules\" (or wherever you apache module lives).

2. copy all the dll's in extensions dir to your windows DLL dir (i would believe it would be c:\windows\system, or winnt\system32 for nt/win2k).

I believe these steps are outlined in the install.txt file.  Please read it (in case I might missed anything).

good luck.
0
 

Author Comment

by:kplonk
ID: 7014984
Ok have found some intereesting info, it would seem that the install of php is fine, if i access the page with a browser running on the php/ apache machine is is well if i access the page form a machine on my network i get the following error

Warning: Failed opening '/home/tkit/web/index.php' for inclusion (include_path='c:\php') in Unknown on line 0

i think the problem may be my host setup which is as follows

<VirtualHost 192.168.0.4>
    ServerName www.tkit.co.uk
    ServerAdmin webmaster@tkit.co.uk
    DocumentRoot /home/tkit/web/
    ErrorLog logs/tkit.co.uk-error_log
    CustomLog logs/tkit.co.uk-access_log common

    DirectoryIndex index.html /cgi-bin/index.pl index.shtml index.php

     <Directory "/home/tkit/web/">
            Options Indexes MultiViews SymLinksIfOwnerMatch Includes
            AllowOverride None
            Order allow,deny
            Allow from all
        </Directory>

</VirtualHost>

does this help any

thanks -k-
0
 
LVL 15

Expert Comment

by:samri
ID: 7015387
It seems weird.

Please check whether the include path c:\php (or c:\php4) did exisit.  Since I seen some inconsistencies here:

Initial comment:
>> Warning: Failed opening '/home/tkit/web/index.php' for inclusion (include_path='c:\php4\includes') in Unknown on line 0
Latest comment:
>> Warning: Failed opening '/home/tkit/web/index.php' for inclusion (include_path='c:\php') in Unknown on line 0

And check if the modules mod_include is loaded (I think it must be, otherwise it won't work on local or remote machine)
--
AddModule mod_include.c


Try to use forward slasd (/), instead of backslash (\) in path separator.

cheers.
0
 
LVL 8

Expert Comment

by:us111
ID: 7015648
This problem could appear when you set some permissions on your folder.

Do you have the lastest php version ?

If you encounter some problems, install EasyPHP:
http://www.easyphp.org/
0
 

Author Comment

by:kplonk
ID: 7015828
Ok sorry the reason for the change is that I changed my iunstiliation of php to exactly what it says in install.txt which it now does. That is what made it work localy. the path c:\php is now there for definate, the ip address of the servere machine is 192.168.0.4 and the ip of the browsering machine is 192.168.0.2,

Some thing else odd is if i access a page browsing form the server machine that uses ssi includes it does not work yet if i access the same page from another machine on the network it works fine.

any ideas
0
 

Author Comment

by:kplonk
ID: 7015875
Also noticed that the DirectoryIndex index.html /cgi-bin/index.pl index.shtml index.php line of the directory config does not seem to work when browsing using the serevere machine,  is all this related have i set the server up incorectly.
0
 
LVL 15

Expert Comment

by:samri
ID: 7016532
When you talk about the "Server", did you refer to the OS, or the Apache.

What version of Apache you are running anyway.

The problem seems weird.  By default, if the httpd.conf is not tweaked so much, I would have suspected that there might be some instability issue.  I have seen the cases where a CGI scripts doesn't work properly, only after a reboot, then it works.

If you could afford to restart from scratch (perhaps uninstalling Apache, and totally install a fresh one -- one tip, just rename the existing "Apache Group" to "Apache Group - OLD" should work).  Otherwise, you should be looking closely at the error.log.

please feedback.

cheers
0
 

Author Comment

by:kplonk
ID: 7016839
Ok server is currently running win 98 with apache 1.2.34 and php 4.2.0 the install is brand new, i have changed very little, would it help to see the full httpd.conf can post if you like as i say there error logs show nothing as the page seems to be servered it is an odd one this.
0
 

Author Comment

by:kplonk
ID: 7016849
I have several machines conected to the same network as the "server" all this machine has to do is run apache and the like. its ip is 192.168.0.4 and the rest of the machines have ips in the form of 192.168.0.X does this help any...

thanks for all the help so far, -k-
0
 

Author Comment

by:kplonk
ID: 7021153
Some more infor, i have been testing my set up for the last few days and have come the the following conclusion, the problem is with the v/hosts on apache, if i call the script by following links form the doc root, ie http://192.168.0.4/charisma/web/test.php there is no proble the script runs fine, wather browsing suing the servere machine or som othere machine on the network. if is reenable v/hosts i am unable to run the script with the following error

Warning: Failed opening '/home/charisma/web/test.php' for inclusion (include_path='.;c:\php') in Unknown on line 0

the vhost set up is as follows

<VirtualHost *>
    ServerName www.charismafashions.com
    ServerAdmin webmaster@charismafashions.com
    DocumentRoot /home/charisma/web/
    ErrorLog logs/charismafashions.com-error_log
    CustomLog logs/charismafashions.com-access_log common
    DirectoryIndex index.html index.shtml index.php

    <Directory "/home/charisma/web/">
            Options Indexes MultiViews SymLinksIfOwnerMatch Includes
            AllowOverride None
            Order allow,deny
           Allow from all
    </Directory>

</VirtualHost>

what am i doing wrong??

any ideas kieran
0
 

Author Comment

by:kplonk
ID: 7021157
I have been testing my set up for the last few days and have come the the following
conclusion, the problem is with the v/hosts on apache, if i call the script by following links form
the doc root, ie http://192.168.0.4/charisma/web/test.php there is no proble the script runs fine, wather browsing uing the server machine
or some othere machine on the network. if i re-enable v/hosts i am unable to run the script with the
following error

Warning: Failed opening '/home/charisma/web/test.php' for inclusion (include_path='.;c:\php') in Unknown
on line 0

the vhost set up is as follows

<VirtualHost *>
   ServerName www.charismafashions.com
   ServerAdmin webmaster@charismafashions.com
   DocumentRoot /home/charisma/web/
   ErrorLog logs/charismafashions.com-error_log
   CustomLog logs/charismafashions.com-access_log common
   DirectoryIndex index.html index.shtml index.php

   <Directory "/home/charisma/web/">
           Options Indexes MultiViews SymLinksIfOwnerMatch Includes
           AllowOverride None
           Order allow,deny
          Allow from all
   </Directory>

</VirtualHost>

what am i doing wrong??

any ideas kieran
0
 
LVL 15

Accepted Solution

by:
samri earned 50 total points
ID: 7022033
Kieran,

Based on your last explanation, I would agree with you.  The Vhost, or something in the Vhost container is missing.

FYI: When your Apache is configure to use Vhost, the first VHost would be the default VHost for request not matching any of the VHost.

Remember, if you try to access your server by http://192.168.0.4/, there should be a Vhost defined (ie.  ServerName 192.168.0.4 defined.  Otherwise the request would fall to the first VHost.

One way to try is, to eliminate Vhost all together, and try.  Yes.  You did confirm this.  Next is to create only ONE Vhost.  This would trap all request to go to this VHost.   Somewhere within the PHP readme (or the installation text) did mention that, you need to define the PHP stuff in each of the Vhost (the global server config will not be effective).  I cannot recapture the exaact text here (maybe need to dig it tomorrow).

Once it is working, then you can start to enable other Vhost.

Give it a shot.
0
 

Author Comment

by:kplonk
ID: 7022155
Thanks for all the help i have spent all day today with the silly thing then hit my self really hard several times where is spoted this "/home/charisma/web/" under windows apache is clevere enough to resolve /home as c:\home in the real world however the path passed to php will be say home/charisma/web/test.php php tries to open this and of course cant because the real path is c:\home\charisma\web\test.php all i had to do was add the c: so the doc root becomes c:/home/charisma/web/ what a silly billy, i have awarded you the points as you have helped me along the way narrow the possibilities down thanks for that

kieran
0
 
LVL 15

Expert Comment

by:samri
ID: 7023032
kplonk,

Thanks for the appreciation.

It never occur to me in the fist place that, that was the error.  Since Apache will take the path fine.  Anything that starts with a slash (/) or backslash (\), will be treated as absolute path, otherwise it will be relative to ServerRoot.

Well, blame it on PHP :)

Cheers.
0
 

Author Comment

by:kplonk
ID: 7024395
no problem as I say thanks for the help
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question