Re: PHP Runs But Does Not Display on Linux

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Wei, Alice J. wrote:
Hi, Guys:

  Thanks for all of you who helped  out, and I can now get this to work, by installing the PHP into the Linux Fedora box I have. What is odd is that on the download page of http://www.php.net, it mentioned the following on the downloads page:

We do not distribute UNIX/Linux binaries.
Most Linux distributions come with PHP these days,
so if you do not want to compile your own, go to your distribution's download site. Binaries available on external servers:

I have followed all the prompts to download it just then, and thanks to those of you reminding me to shut down the apache before I restart it, it is now displaying Hello where it is supposed to be on the PHP page.
Would anyone say that the statement on the php page above should be modified somehow?

No. php.net does not provide Linux binaries. They provide source that you can compile into a binary if you need to modify the build. Their point is that most distributions (Fedora, Debian, etc...) provide a PHP binary in the form of a RPM, DEB package etc... that in your case you can install using yum, etc...

-Shawn


Alice
======================================================
Alice Wei
MIS 2009
School of Library and Information Science
Indiana University Bloomington
ajwei@xxxxxxxxxxx
________________________________________
From: Thijs Lensselink [dev@xxxxxxxx]
Sent: Thursday, June 12, 2008 10:44 AM
To: php-general@xxxxxxxxxxxxx
Subject: RE:  PHP Runs But Does Not Display on Linux

Quoting "Wei, Alice J." <ajwei@xxxxxxxxxxx>:

Hello,

  I have reinstalled Apache back into my Linux machine, and placed the code


  <html>
   <head><title>Test</title>
  <body>
  <p>This is test</p>
   <?php echo "Hello!"; ?>
  </body>
   </html>

into the apache/htdocs folder titled hello.php

  When I execute it from the browser using an http:// address
followed by the IP address and hello.php, I get this pop up message
that asks me if I wanted to open up my file and what I want to do
with it.
  Is it necessary for me to install anything else? I have added the
AddType application/x-httpd-php .php into the httpd.conf file, so
now it is not giving me "file does not exist" error anymore, but how
 do I get thie accurate output to show up from the browser?


I welcome any suggestion.

Alice
======================================================
Alice Wei
MIS 2009
School of Library and Information Science
Indiana University Bloomington
ajwei@xxxxxxxxxxx
________________________________________
From: DeadTOm [deadtom@xxxxxxxxxxxx]
Sent: Wednesday, June 11, 2008 11:15 PM
To: Wei, Alice J.
Cc: php-general@xxxxxxxxxxxxx
Subject: Re:  PHP Runs But Does Not Display on Linux

With localhost I was assuming that the files resided on your local
machine, my bad. How are you accessing these files? The location you are
getting them from has to be running a web server of some kind with php
or the php scripts will not run and you'll only see the html output as
you described.
I run a linux server with apache2, php and mysql and I believe that the
purpose of the php5-mysql package is to add files that define those
mysql function calls. I'm sure that there is something similar for mssql.

-Allen

Wei, Alice J. wrote:
Hi,

-----Original Message-----
From: DeadTOm [mailto:deadtom@xxxxxxxxxxxx]
Sent: Wednesday, June 11, 2008 10:58 PM
To: Wei, Alice J.
Cc: php-general@xxxxxxxxxxxxx
Subject: Re:  PHP Runs But Does Not Display on Linux

OK, I see now.
When you open the script from your browser are you accessing it via a
server like Http://localhost/some/file.php or are you just opening a php
file on your hard drive? I'm guessing you're accessing it on the hard
drive directly, which will not work since PHP scripts are executed
server side. So you will need to install apache2 with php.
As far as the mssql_connect error goes, the same rule applies. You need
to have the proper php module installed to define for php what the
mssql_connect function does, otherwise php doesn't know what it is and
yells at you for not defining the function.

-Allen

Thanks for clarifying the first point, and that is probably why.
As for the second point, according to
http://us.php.net/manual/en/function.mssql-connect.php, isn't
mssql_connect defined already as something internal within PHP? Or,
 am I missing something here?

Plus, I connect this not to the localhost, but to a different
Windows machine, so does this mean that I have to install it? One
of the members on the list suggested something from
http://www.freetds.org/, if this is something I have to install, I
will definitely give it a shot.

Alice


Wei, Alice J. wrote:

Hi,

   For testing purpose, I have something like

   <html>
    <head><title>Test</title>
   <body>
   <p>This is test</p>
    <?php echo "Hello!"; ?>
   </body>
    </html>

  I see the following from the command prompt when I execute the
above script:

   <html>
    <head><title>Test</title>
   <body>
   <p>This is test</p>Hello
   </body>
    </html>

  On the browser, I only see:

    <html>
    <head><title>Test</title>
   <body>
   <p>This is test</p>
     </body>
    </html>

  I just realized that the mysql_connect error is a typo, I should
 have typed mssql_connect. I call this from a different machine,
so  I shouldn't get this kind of error even if I don't have it
installed, right? Or, am I missing something here?

Alice

-----Original Message-----
From: DeadTOm [mailto:deadtom@xxxxxxxxxxxx]
Sent: Wednesday, June 11, 2008 10:46 PM
To: Wei, Alice J.
Cc: php-general@xxxxxxxxxxxxx
Subject: Re:  PHP Runs But Does Not Display on Linux

 >Otherwise, it consistently gives me errors "Call to undefined
function: mysql_connect()...".If you're getting an error...

If you're getting this error, there is a line of code in the php script
that is trying to connect to a mysql database and the mysql extension
for php is not installed. So php doesn't know this function is supposed
to do hence, the "undefined function" error.

 >I can only see the HTML code of the php functions I call within the
code at the command output in text format, but I cannot see it on the
"browser."

I'm a little confused about what you mean here. You shouldn't see any
HTML code in your browser.

Wei, Alice J. wrote:


Hi,

  I have originally commented out all the MS SQL lines in the
php.ini files so that it supports MS SQL, but that does not seem
to work. MySQL? Since I am not using that to connect my PHP to,
do I still need to install it? By the way, my Microsoft SQL
server database is on a different Windows machine.

Alice

-----Original Message-----
From: DeadTOm [mailto:deadtom@xxxxxxxxxxxx]
Sent: Wednesday, June 11, 2008 10:29 PM
To: Wei, Alice J.; php-general@xxxxxxxxxxxxx
Subject: Re:  PHP Runs But Does Not Display on Linux

Do you have php-mysql installed? In ubuntu for php5 the package is
php5-mysql.

-Allen

Wei, Alice J. wrote:



Hi,

  I am currently using a Linux box with Fedora to run my PHP
scripts, which I have seen in the download page at
http://www.php.net/downloads.php that

   We do not distribute UNIX/Linux binaries. Most Linux
distributions come with PHP these days.

  What I am wondering is, if I can run my scripts by using the
command like php some_php.php, as long as it does not require me
 to have it displayed on the web page or in need of using a
mssql_connect function, it does not give me any errors at all.
Otherwise, it consistently gives me errors "Call to undefined
function: mysql_connect()...".

  I can only see the HTML code of the php functions I call
within the code at the command output in text format, but I
cannot see it on the "browser."

  Are these two errors related? I tried installing PHP and
Apache afterwards, but it seems that it is not providing a
different message. Have I missed something here?

Anything is appreciated.

Alice
======================================================
Alice Wei
MIS 2009
School of Library and Information Science
Indiana University Bloomington
ajwei@xxxxxxxxxxx












Take a look in your apache config file and see if you have these lines :

LoadModule php5_module [your PHP module]

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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux