[LUNI] Epic LAMP Fail

Clyde Forrester clydeforrester at gmail.com
Tue Sep 14 01:12:02 CDT 2010


Yes. You could have a file called hello.php:

<?php
  print "Hello";
?>

Then you type php hello.php

Also you can do a which php and put that in the "shebang" line at the 
top of the php file.

#!/usr/bin/php

Then of course it'll fold it's arms and refuse to cooperate.
So you have to do a chmod +x hello.php
And of course, if it gets really clueless, you have to type
./hello.php
for it to catch on to the idea that it's right here in the current 
directory.

I created a php script with the mysql_connect(...) in it,
and it gave me a blank stare and no errors.

So, I put a print command after the connect, and it printed the text.

So, I figure that php is working fine with mysql from the command line, 
but for some reason not with apache2 html.

I plan to add to the command line script to see if I can read from the 
table and print what I get from mysql to the screen.

Then I'll post what happened.

c4

Carl Karsten wrote:
> how do you run a .php scrip from the command line?
> 
> I am guessing $ php foo.php
> 
> 
> 
> On Mon, Sep 13, 2010 at 4:06 PM,  <jjirsa at comcast.net> wrote:
>> Clyde,
>>
>> If you see a section for "mysql", "mysqli", and "pdo" in the phpinfo()
>> output, then the modules are loaded.
>> So, if you run a script at the command line with a call to mysql_connect(),
>> do you still get an error?
>> If you call it from a browser, do you get an error?
>>
>> BTW, some distros have a CLI and an Apache PHP config file (like in SuSE,
>> you have /etc/php5/cli/php.ini and /etc/php5/apache2/php.ini), so depending
>> on how the page is called, you might or might not see an error.
>>
>> Jeff


More information about the LUNI mailing list