Link to home
Start Free TrialLog in
Avatar of mkido
mkido

asked on

Setting up a New PHP program in a brand new Fedora Core Server, How?

Hello!   Everyone,

The following PHP script doesn't run in a brand new Fedora Core.   What should I edit on /etc/php.ini.   Should I add my username?   Thank you for help!


#!/usr/bin/php

<!-- This is another comment line after shell-bang -->



<html><head><title></title></head>



<body>



<h1>A Test!</h1>



<?



// A comment line, if it hides



$userName = "Mitsuru";

print "Hi there! $userName";



?>



</body>

</html>

Avatar of bimal_linux
bimal_linux

#rpm -qa|grep php
What is the out put?? Could you please confirm necessary php rmps are inplace in the system?

Regards,
Bimal Mankara
Avatar of mkido

ASKER

Hello!  Bimal_linux,

Here is the output.   What do you think?   Is this about the running PHP version?  

[root@biwa root]# rpm -qa | grep php
php-imap-4.3.3-6
php-4.3.3-6
php-ldap-4.3.3-6
[root@biwa root]#

By the way, which file permission should the PHP file have?   755?  
Avatar of mkido

ASKER

How about, is there any other way to test if PHP program is functional (or operating) by a simple test?    Such as by a command line test?  
Avatar of mkido

ASKER

I am also wondering that the Place of file is not the correct place.   Right now, I put the PHP file at,
   /var/www/cgi-bin/TEST/

I am assuming that PHP file should be treated like a PERL CGI?   Am I right?   Or do I place PHP files somewhere else.   Or should I configure "php.ini" file?    Any suggestion?  
Avatar of mkido

ASKER

When I was browsing about PHP, I saw some some PHP is missing the first line of Poud-Bang (#!) magic line,

In PERL,
 #!/usr/bin/perl
print "<HTML>\n";
print "<BODY>\n";
print "<P>Welcome, $Name</P>\n";
print "</BODY>\n";
print "</HTML>\n";

And now in PHP:
<HTML>
<BODY>
<P>Welcome, <?php print $Name; ?></P>
</BODY>
</HTML>

When the magic line is necessary, and when it isn't necessary?    
Avatar of mkido

ASKER

Another question I have is, (to bimal_linux), what is this rpm check.  

php-imap-4.3.3-6
php-4.3.3-6
php-ldap-4.3.3-6

 If it shows above, then that means the PHP program (module) is loaded and running?   I tried addition of modules based on the FAQ 53 of (www.php.net) onto "httpd.conf", but it didn't accept the module addition.
Avatar of mkido

ASKER

Hello!,  

I found a command level running of .php script according to the textbook, "PHP Cookbook" (O'Reilly)" page 518.

Then one of my .php script which runs at command level was executed from a .html page.   Then it shows as below.   Where can I adjust the REDIRECT_STATUS CGI in the Apache Server.   Is it /etc/httpd/conf/httpd.conf ????


==========  What I got, now  ==========
Security Alert! The PHP CGI cannot be accessed directly.

This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that a page will only be served up if the REDIRECT_STATUS CGI variable is set, e.g. via an Apache Action directive.

For more information as to why this behaviour exists, see the manual page for CGI security.

For more information about changing this behaviour or re-enabling this webserver, consult the installation file that came with this distribution, or visit the manual page.
=========================
ASKER CERTIFIED SOLUTION
Avatar of bimal_linux
bimal_linux

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mkido

ASKER

It's start WORKING!!!!

Thank you very very much.   By the way,

You said,
--Your appache installation has the php support. (thank you for the rpm list).--

How do you read the response of
rpm -qa | grep php ??

php-imap-4.3.3-6
php-4.3.3-6
php-ldap-4.3.3-6

Does this suggest it's OK to run in /var/www/html?    I don't have to treat .php as CGI?    In what condition, I have to treat .php script as CGI?   I will close soon, but just a final talk.   Thanks.
Hi,

if you have the rpm package: php-4.3.3-6, the php support for httpd will be there. And I assumed httpd server is already installed. What was pending is the correct location for your php script. Usually php is not using as CGI. It is not appreciable and is difficult ;) . YOu can treat any executable script as cgi. why only php? Dont go for php as cgi unless your application require it.

Thanks
Bimal Mankara
Avatar of mkido

ASKER

Thank you very much.   My a few PHP scripts are working fine, and I feel great.   Thanks.