Solved

Problem setting up php on apache

Posted on 2002-05-14
18
243 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
  • 11
  • 6
18 Comments
 
LVL 15

Expert Comment

by:samri
Comment Utility
> 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
Comment Utility
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
Comment Utility
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
 
LVL 15

Expert Comment

by:samri
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 15

Expert Comment

by:samri
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
no problem as I say thanks for the help
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
tomcat LDAP authentication issue 3 123
htaccess file errors for 301 Redirect 4 63
XAMPP 3 44
whm high memory usage in processes 7 34
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…
It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now