LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 06-11-2002, 06:34 PM   #1
niehls
Member
 
Registered: Jun 2002
Location: Sweden
Distribution: slack, redhat
Posts: 91

Rep: Reputation: 15
programming php in linux


i'm pretty much a complete newbie in linux. I was planning to start learning how to program PHP and use SQL.
My problem is that i have absolutely no idea how to make PHP work in linux. my networking knowledge is pretty limited, so i don't know what i should do..
i do not wish to upload anything. just try it on my computer.
do i have to configure/use apache?
what configurations do i have to do to make my browser recognise PHP when run from my HDD?

any link to an extremely step by step guide or anything would be appreciated..
 
Old 06-11-2002, 09:17 PM   #2
crabboy
Moderator
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,823

Rep: Reputation: 120Reputation: 120
To do anything good with PHP you will have to use Apache. You can't view PHP through your browser. You will need Apache configured with PHP.

I just looked at the PHP manual and it is very detailed. It should not be that difficult to follow, even for a beginner.

http://www.php.net/manual/en
 
Old 06-12-2002, 06:14 AM   #3
niehls
Member
 
Registered: Jun 2002
Location: Sweden
Distribution: slack, redhat
Posts: 91

Original Poster
Rep: Reputation: 15
does anyone know a webhost with php-support?
a free one, that is.
 
Old 06-12-2002, 07:02 PM   #4
entm
Member
 
Registered: Oct 2001
Location: Atlanta, GA
Distribution: Red Hat 7.0
Posts: 45

Rep: Reputation: 15
If you have Linux, then you can run your own Apache Webserver. Just make sure that it is only accessable from localhost. The default settings for your firewall should be sufficient to block anyone from accessing your webserver.

You can get apache and PHP RPM's from www.rpmfind.net. Just search for Apache and PHP.

Install the most recent RPM's for Apache and then PHP. It looks like you are using RedHat, and if so, it is a pretty easy install. There is an additional RPM for PHP that you will need to install if you want to use MySQL.

I can go into the specifics if you require. I did all this about 2 weeks ago when I reinstalled Linux on a new drive.
 
Old 06-12-2002, 08:25 PM   #5
niehls
Member
 
Registered: Jun 2002
Location: Sweden
Distribution: slack, redhat
Posts: 91

Original Poster
Rep: Reputation: 15
that would be appreciated.
i don't really know a thing about apache.
it seems like i have both apache and php installed. (whereis returns paths)
apache is in /usr/lib/apache and php in /usr/bin/php
how do i configure my server so that i can run php?
do i have to start the apache server in any way?
where do i put my .php files?

heard something 'bout editing httpd.conf. did this in windows some time ago. if so..what changes has to be made?

thanx
 
Old 06-12-2002, 08:28 PM   #6
niehls
Member
 
Registered: Jun 2002
Location: Sweden
Distribution: slack, redhat
Posts: 91

Original Poster
Rep: Reputation: 15
ah..,kinda figured parts of it out. simply tried http://localhost in my browser. believe i should put the files in /var/www
that directory contains directories for cgi, perl and html. how do i add support for php?
 
Old 06-12-2002, 08:30 PM   #7
niehls
Member
 
Registered: Jun 2002
Location: Sweden
Distribution: slack, redhat
Posts: 91

Original Poster
Rep: Reputation: 15
hehe..nevermind..was easier than i thought..
thanks anyway.
better think before i post anything the next time, eh?
 
Old 07-29-2003, 06:23 PM   #8
meragran
LQ Newbie
 
Registered: Jul 2003
Location: Norway
Posts: 2

Rep: Reputation: 0
PHP wouldn't print COUNT(*)

I use a PHP script that send a query to my MySQL. When i want the php-script to print the COUNT(*) it returns a error that I can't remeber. But do someone think they can help me?
 
Old 07-30-2003, 11:03 PM   #9
razormonkey
LQ Newbie
 
Registered: Jul 2003
Distribution: Red Hat 9
Posts: 9

Rep: Reputation: 0
I'm a noob to but this is how I did it.....

//your connection to db
$sql = "select count(*) from $table";
$result = mysql_query($sql, $db);
$row = mysql_fetch_array($result);
printf ("Count = %s", $row[0]);

Hope this helps......
 
Old 07-31-2003, 03:07 AM   #10
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,414

Rep: Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966
don't use COUNT(*) use mysql_num_rows() instead on a normal query
 
Old 07-31-2003, 06:51 AM   #11
niehls
Member
 
Registered: Jun 2002
Location: Sweden
Distribution: slack, redhat
Posts: 91

Original Poster
Rep: Reputation: 15
why? isn't count faster?
 
Old 07-31-2003, 07:47 AM   #12
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,414

Rep: Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966
well do you not want this information for a reason? it's just tidier and more effective.
 
Old 07-31-2003, 02:56 PM   #13
niehls
Member
 
Registered: Jun 2002
Location: Sweden
Distribution: slack, redhat
Posts: 91

Original Poster
Rep: Reputation: 15
well. doesn't matter now. that post is a year old.
 
Old 07-31-2003, 03:07 PM   #14
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,414

Rep: Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966
ack, why do people do that?!?!?!?!

PLEASE DON'T DRAG UP REALLY OLD THREADS!!!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
software for programming php on linux huunguyen Linux - Newbie 6 07-05-2005 10:40 AM
PHP Programming Help NeoSephiroth Programming 1 10-17-2004 06:49 AM
programming PHP JROCK1980 Programming 2 04-15-2004 06:02 AM
PHP programming!!!! InSane103 Programming 6 07-12-2003 01:25 PM
PHP programming on X cathodion Linux - Software 6 05-17-2002 03:00 AM


All times are GMT -5. The time now is 03:44 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration