★ wanayoo — archive 1999 http://www.devshed.com/Talk/Forums/Forum5/HTML/002138.htmlNouvelle recherche | Portail wanayoo
DevShed Menu
* DevShed Home
* Developer News
* DevShed Brain Dump




UBBFriend: Email This Page to Someone!
  DevShed Discussion Forums
  PHP
  Newbie:Can't view file.php in browser

Post New Topic  Post A Reply
profile | register | preferences | faq | search

next newest topic | next oldest topic
Author Topic:   Newbie:Can't view file.php in browser
mlleong09
Member
posted July 26, 2000 09:27 PM     Click Here to See the Profile for mlleong09   Click Here to Email mlleong09     Edit/Delete Message Reply w/Quote
I've successfully install mysql-3.22.32, php4 and apache-1.3.12. Everything went fine.
I've type a simple php script and tried to view in my browser(Nestcape) but the file doesn't not appear! Instead there's a dialog box asking me to save the file.

I've already uncomment 2 lines in httpd.conf as instructed. Please help me.
Thanks in advance.

------------------

jgagner
Member
posted July 26, 2000 10:50 PM     Click Here to See the Profile for jgagner   Click Here to Email jgagner     Edit/Delete Message Reply w/Quote
We'll abviosly the server isn't parsing the php file. You sure you installed PHP correctly?

mlleong09
Member
posted July 27, 2000 01:05 AM     Click Here to See the Profile for mlleong09   Click Here to Email mlleong09     Edit/Delete Message Reply w/Quote
dear jgagner,

I've install php-4.0.0.tar according to the instruction.(The Soothingly Seamless Setup of Apache, SSL, MySQL, and PHP - June 07, 2000 )
url:http:http://www.devshed.com/Server_Side/PHP/SoothinglySeamless/page7.html

Could u guide me the correct way of installation and configuring php? How can i detect that i've install php correctly?
Thanks.

[This message has been edited by mlleong09 (edited July 27, 2000).]

dwarf
Member
posted July 27, 2000 01:20 AM     Click Here to See the Profile for dwarf     Edit/Delete Message Reply w/Quote
Did you set the AddType directive in httpd.conf??? It seems that Apache doesn't know that the *.php file is parsable...

Check that directive, and tell us what you've found...

mlleong09
Member
posted July 27, 2000 03:49 AM     Click Here to See the Profile for mlleong09   Click Here to Email mlleong09     Edit/Delete Message Reply w/Quote
Yes. I've set the AddType directive in the httpd.conf(located in the /usr/local/apache/conf). Below is the statement :

AddType application/x-httpd-php .php3 .php
AddType application/x-httpd-php3-source .phps

rycamor
Member
posted July 27, 2000 08:49 AM     Click Here to See the Profile for rycamor   Click Here to Email rycamor     Edit/Delete Message Reply w/Quote
What operating system is your server running? And what is the filename and source code of the simple php script you are trying to run?

tigg
Member
posted July 27, 2000 10:34 AM     Click Here to See the Profile for tigg     Edit/Delete Message Reply w/Quote
Try killing the pid of httpd then starting apache again.

ps -alef|grep httpd
(the pid should be at the top of the fourth column)
kill -TERM pid
(replace pid with the number)
/usr/local/apache/bin/apachectl start

aarongb
Member
posted July 27, 2000 03:17 PM     Click Here to See the Profile for aarongb   Click Here to Email aarongb     Edit/Delete Message Reply w/Quote
The default lines in httpd.conf refer to php3, not php4. Additionally, you may have forgotten to restart Apache afer installing PHP, or editing httpd.conf.

Use this instead:
AddType application/x-httpd-php .php4 .php
AddType application/x-httpd-php-source .phps

to test installs, put this in a file called phpinfo.php4

<?
phpinfo()
?>

mlleong09
Member
posted July 27, 2000 07:00 PM     Click Here to See the Profile for mlleong09   Click Here to Email mlleong09     Edit/Delete Message Reply w/Quote
My OS is Corel Linux. The simple script i'm trying to run is as below :
<html><head><title>PHP Test</title></head>
<body>
<? php echo "Hello<P>"; ?>
</body></html>

i have save this document as test.php

reply for aarongb:
I've made changes as instructed and tested below script :
<?
phpinfo()
?>

the browser display:
<?
phpinfo()
?>

Should i change back php4 to php3?(already stated in the httpd.conf that those 2 statement is for php4)
# And for PHP 4.x, use:
AddType application/x-httpd-php .php3 .php
AddType application/x-httpd-php3-source .phps

I'm quite lost, please help me ...

reply for tigg:
what number should i replace the pid?
i tried 4, and no error messg. and the i start httpd again. then i tried to browse the file again. It won't work.

[This message has been edited by mlleong09 (edited July 28, 2000).]

dwarf
Member
posted July 28, 2000 01:10 AM     Click Here to See the Profile for dwarf     Edit/Delete Message Reply w/Quote
Waht about the Action directive?? Or maybe ScriptAlias directive?? Did you set these two???

mlleong09
Member
posted July 28, 2000 03:36 AM     Click Here to See the Profile for mlleong09   Click Here to Email mlleong09     Edit/Delete Message Reply w/Quote
What should i write for the Action directive and script alias?

where should i write those statement?(which line / paragraph in httpd.conf).

aarongb
Member
posted July 28, 2000 02:29 PM     Click Here to See the Profile for aarongb   Click Here to Email aarongb     Edit/Delete Message Reply w/Quote
Okay,
If you have installed php as an Apache module, use #1 below. if you have installed it as CGI follow #2.

1. make sure the following is uncommented in httpd.conf:
LoadModule php4_module modules/libphp4.so
AddModule mod_php4.c
Additionally you'll want to comment out anything that is *php3*.

2.
Scriptalias and Action filled in httpd.conf
I'm running as module on linux, but this is how rhe two lines appear in my NT install.
(scriptalias was required for php3 but not php4)
be sure to copy php to the cgi-bin.
Action application/x-httpd-php4 "/cgi-bin/php.exe"

And while I'm here, to answer for Tigg, when you run "ps -alef|grep httpd" the very first number that appears is the pid (process ID) for each process. You may have many httpd processes running. Simply do "Kill -TERM nn" nn is the pid derived from the above ps command.

Additionally, "/usr/local/apache/bin/apachectl start" works, and I have gotten "/usr/local/apache/bin/apachectl restart" to work occassionally (but not on my latest install from RPM)which lets you avoid the whole "ps..." command.

And keep php4, even though you are having some problems, its worth it in the end. We've all run into little undocumented "ass-pains" occassionally.

mlleong09
Member
posted August 01, 2000 12:32 AM     Click Here to See the Profile for mlleong09   Click Here to Email mlleong09     Edit/Delete Message Reply w/Quote
I've already uncomment those LoadModule and AddModule, but it still can't solve the problem. Netscape browser still can't view the below script(phpinfo.php) :
<? phpinfo() ?>

I notice that there is 2 httpd.conf file. one is at etc/apache and the other is at usr/local/apache/conf. which is the file that the system will execute. I notice that the contents is not the same. LoadModule statement is at etc/apache whereas AddType Application is at usr/local/apache/conf.

Is it because Corel Linux is a subset of Debian, then the apache won't work? This bother me coz' i've install the same thing(mysql, php4 and apache) to Red Hat Linux and the browser can view the php script.

When i type http://localhost/ Red hat pc will display apache test page website and corel linux pc will display the debian GNU Linux.
Is this mean that I should eliminate Debian from Corel linux? HOW this is done?

tigg
Member
posted August 01, 2000 11:00 AM     Click Here to See the Profile for tigg     Edit/Delete Message Reply w/Quote
the pid is the number at the top of the fourth column when you do the "ps ..." command

mlleong09
Member
posted August 01, 2000 09:36 PM     Click Here to See the Profile for mlleong09   Click Here to Email mlleong09     Edit/Delete Message Reply w/Quote
I've read through the Debian website and found out that /usr/local is not under Debian control, therefore any installation should be install under /usr/local/src.

The bad news is, i've already install it under /usr/local/src but the php script still didn't workable(can't be browse at the browser).

Is anyone out there could share your expertise ? I'm having such a big headache with this installation. I just want to develop php4 scripting under corel linux pc!

[This message has been edited by mlleong09 (edited August 01, 2000).]

osnap
Junior Member
posted August 01, 2000 10:25 PM     Click Here to See the Profile for osnap   Click Here to Email osnap     Edit/Delete Message Reply w/Quote
Here is how I installed Apache with PHP4, maybe it'll help you some.

First uncompress the files.

Then: cd apache-xxx

in apache dir do: ./configure --prefix=/usr/local/apache

Then: cd ..

cd php-xxx

in php dir do: ./configure --with-mysql=/usr/local/mysql --with-apache=../apache-xxx --enable-track-vars

make
make install

cp php.ini-dist /usr/local/lib/php.ini

cd ..

cd apache-xxx

./configure --activate-module=src/modules/php4/libphp4.a --enable-module=php4 --prefix=/usr/local/apache

make
make install

edit httpd.conf so you have

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

start apache with /usr/local/apache/bin/apachectl start

then test it and it should work, it did for me.

BTW, I don't think it matters where you install php and apache in corel, as long as you tell it when you configure it. And if you need any linux help go to www.linuxnewbie.org because there is a forum like this one there and someone there might can help you with corel more than I can.

mlleong09
Member
posted August 02, 2000 09:06 PM     Click Here to See the Profile for mlleong09   Click Here to Email mlleong09     Edit/Delete Message Reply w/Quote
dear osnap,
thanks a lot for the full guide of installation but that's also the same that i follow .. AND IT only works in Red hat Linux(as i mention earlier).

anyway .. i've figure out how to install all those stuff in Corel Linux(which is under control Debian management).
All i need to do is to delete these folder:
1. /etc/apache (CL apache configuration)
2. /var/www (CL default localhost website)
3. /var/log/apache (CL apache log)
4. /etc/apache/cron.conf

then the installation will succceed!
thanks to all for ur concern.

All times are MST (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply
Hop to:

Contact Us | DevShed.com

Copyright © 1997-2000 ngenuity. All rights reserved.

Powered by: Ultimate Bulletin Board, Version 5.41a
© Infopop Corporation (formerly Madrona Park, Inc.), 1998 - 1999.