PHP help here

Pages

AuthorTopic: PHP help here
Master
Member # 4614
Profile Homepage #0
What all do I need to get started, or what would you recommend?

--------------------
-ben4808

For those who love to spam:
CSM Forums
RIFQ
Posts: 3360 | Registered: Friday, June 25 2004 07:00
Guardian
Member # 2238
Profile Homepage #1
Quit and leave it to the pros.

That's what I do...

--------------------
The critics agree!

Demonslayer is "a five star hit!" raves TIMES Weekly!

"I've never heard such thoughtful comments. This man is a genious!" says two-time Nobel Prize winning physicist Erwin Rasputin!
Posts: 1582 | Registered: Wednesday, November 13 2002 08:00
Shaper
Member # 32
Profile #2
Take a course at a nearby college and purchase several books on the subject...

--------------------
Lt. Sullust
Cogito Ergo Sum
Polaris
Posts: 2462 | Registered: Wednesday, October 3 2001 07:00
Shock Trooper
Member # 4557
Profile #3
From you're other posts I assume you know C++ already right? From what I know of PHP (which isn't much), its much simpler than C++. You should be able to learn it fairly easily through a few tutorials.

Here's one:
http://www.w3schools.com/php/default.asp

You should note, however, that PHP sucks.
Posts: 264 | Registered: Wednesday, June 16 2004 07:00
Master
Member # 4614
Profile Homepage #4
Okay, so do I need to download PHP, MySQL, and Apache server for it to work?

Hey, Aran! :D

--------------------
-ben4808

For those who love to spam:
CSM Forums
RIFQ
Posts: 3360 | Registered: Friday, June 25 2004 07:00
Infiltrator
Member # 154
Profile #5
Yes.

Don't forget to do it as an Apache Module, not CGI.

--------------------
Inconsistently backward.
SWOH. IM, PATF, ND.
Posts: 612 | Registered: Saturday, October 13 2001 07:00
Master
Member # 4614
Profile Homepage #6
All right. Will try.

--------------------
-ben4808

For those who love to spam:
CSM Forums
RIFQ
Posts: 3360 | Registered: Friday, June 25 2004 07:00
Law Bringer
Member # 2984
Profile Homepage #7
quote:
Originally written by Mister Maoben:

Okay, so do I need to download PHP, MySQL, and Apache server for it to work?

Hey, Aran! :D

You are asking me? My accomplishment concerning PHP is to make it suck even more than it already does. It is good you cannot see the sourcecode of the postcount script.

--------------------
The Encyclopaedia Ermariana <-- Now a Wiki!
"Polaris leers down from the black vault, winking hideously like an insane watching eye which strives to convey some strange message, yet recalls nothing save that it once had a message to convey." --- HP Lovecraft.
"I single Aran out due to his nasty temperament, and his superior intellect." --- SupaNik
Posts: 8752 | Registered: Wednesday, May 14 2003 07:00
Master
Member # 4614
Profile Homepage #8
Well, you too had to have gotten started somehow.

--------------------
-ben4808

For those who love to spam:
CSM Forums
RIFQ
Posts: 3360 | Registered: Friday, June 25 2004 07:00
Agent
Member # 1104
Profile Homepage #9
You don't really have to install Apache as a server to use PHP, but it kinda works best on it. I personally use IIS since it's already installed on my comp.

As for getting started with PHP, buy a book, it really does help. And the upside to getting a book is that you don't have to stare at a bright computer screen while learning the language. Another thing that might help is looking at already existing scripts, take them apart, see how the script works and what techniques are used, etc. I personally learned PHP by looking through the Invision Powered Board source code (when it was free).

The last suggestion I'd give is if you want to look up what a certain function does, the easiest way is to go to www.php.net/<insert_function_name>. Take note of the user comments posted on the page as well, as they do have various goodies and timesavers.

quote:
You should note, however, that PHP sucks.
As opposed to what?

[ Saturday, July 23, 2005 13:44: Message edited by: RC ]

--------------------
Austrian Alex - Reality Corp.
Posts: 1307 | Registered: Tuesday, May 7 2002 07:00
Shock Trooper
Member # 4557
Profile #10
For web programming, Perl. For GUI programming, C++/Java.
Posts: 264 | Registered: Wednesday, June 16 2004 07:00
Master
Member # 4614
Profile Homepage #11
Well, I downloaded PHP 5.0.4 and Apache2 and am slowly working on MySQL (37MB is quite a bit), but I still can't figure out at all how what I'm supposed to do next. I just want to get to where I can start learning.

--------------------
-ben4808

For those who love to spam:
CSM Forums
RIFQ
Posts: 3360 | Registered: Friday, June 25 2004 07:00
Agent
Member # 1104
Profile Homepage #12
Firstly, install Apache. Here's a guide that'll help you out (I assume you're using windows):
http://httpd.apache.org/docs/2.0/platform/windows.html

Then get PHP installed:
http://us2.php.net/manual/en/install.windows.apache2.php

Then MySQL (which should be one of the easier things to install):
http://dev.mysql.com/doc/mysql/en/windows-installation.html

That should pretty much cover it all, but you still might run into a few minor conflicts, it happens.

[ Saturday, July 23, 2005 16:01: Message edited by: RC ]

--------------------
Austrian Alex - Reality Corp.
Posts: 1307 | Registered: Tuesday, May 7 2002 07:00
Master
Member # 4614
Profile Homepage #13
Is there something special I have to do in order to try some things out offline, you know, just reading PHP documents from the hard drive with a browser?

--------------------
-ben4808

For those who love to spam:
CSM Forums
RIFQ
Posts: 3360 | Registered: Friday, June 25 2004 07:00
Agent
Member # 1104
Profile Homepage #14
You can directly edit PHP documents with any text editor on your hard drive, but in order to run them, you have to send the PHP script through the server (in this case, that would be Apache). Put the script in the htdocs directory, point your browser to http://localhost/<file_name>.php (or http://127.0.0.1/<file_name>.php). And no, you don't have to be connected to the internet to run the scripts through Apache, you just have to have eveything set up correctly.

For example, you can put this into a text file and rename it to test.php:
<?php
// This text should not be visible
phpinfo();
?>
Then put this file into c:\Program Files\<Apache Directory>\htdocs

Next, open up a browser and type in localhost/test.php. If you see the source, then PHP has not been properly configured. If you see an error or 404 message, Apache hasn't been set up correctly (or is using a port besides 80, in which case, use localhost:<port_number>/test.php). If you see the PHP Info, then everything has been set up and all's good.

Edit: Also, if you're running these scripts offline, I've found it better to use a browser like firefox which won't give you annoying "You're working offline" messages every time you try to load a page.

[ Saturday, July 23, 2005 19:55: Message edited by: RC ]

--------------------
Austrian Alex - Reality Corp.
Posts: 1307 | Registered: Tuesday, May 7 2002 07:00
Infiltrator
Member # 154
Profile #15
Regarding PHP-sucks-persons:

PHP sucks.
Perl sucks more.
Ruby sucks even moreso.

I don't know about Python, but I doubt I'd put it underneath Perl.

[ Sunday, July 24, 2005 04:46: Message edited by: Kakakaka ]

--------------------
Inconsistently backward.
SWOH. IM, PATF, ND.
Posts: 612 | Registered: Saturday, October 13 2001 07:00
Master
Member # 4614
Profile Homepage #16
So what do you suggest, Kakakaka? :P

Or else be quiet.

----

RC, thanks lots for your help, but every time I try to rename by text file "test.php," it stays a text file: "test.php.txt." Does this mean I'm not configured properly?

[ Sunday, July 24, 2005 11:47: Message edited by: Mister Maoben ]

--------------------
-ben4808

For those who love to spam:
CSM Forums
RIFQ
Posts: 3360 | Registered: Friday, June 25 2004 07:00
Agent
Member # 1104
Profile Homepage #17
No, it means you need to change the settings in Notepad to save as "All File Types" instead of just a text file. You should see a pulldown menu with those options when you save the file using "Save As". Alternatively, you could just rename the file by deleting the last part of the file name (.txt).

I'd recommend getting Crimson Editor to use as a PHP editor, though, instead of Notepad (Dreamweaver is nice, too, but it's quite expensive).

@Kakaka - Let me guess, Microsoft ASP/ASP.NET?

[ Sunday, July 24, 2005 12:38: Message edited by: RC ]

--------------------
Austrian Alex - Reality Corp.
Posts: 1307 | Registered: Tuesday, May 7 2002 07:00
Shock Trooper
Member # 4557
Profile #18
quote:
Originally written by Kakakaka:

Regarding PHP-sucks-persons:

PHP sucks.
Perl sucks more.
Ruby sucks even moreso.

I don't know about Python, but I doubt I'd put it underneath Perl.

All scripting languages suck. They are the quickfix created by people who instead of creating code to simplify their problem, create entirely new languages that end up creating new problems. They are designed with fast production in mind, and are intrinsically commercial. Of these languages, Perl is fairly powerful, and Python is probably the best to use due to the implications of Boost-Python.

quote:

I'd recommend getting Crimson Editor to use as a PHP editor, though, instead of Notepad (Dreamweaver is nice, too, but it's quite expensive).

I never used it, so I can't really be sure, but Dev-PHP (http://devphp.sourceforge.net/) might be helpful.
Posts: 264 | Registered: Wednesday, June 16 2004 07:00
Infiltrator
Member # 154
Profile #19
I'd suggest PHP or Python. :P

--------------------
Inconsistently backward.
SWOH. IM, PATF, ND.
Posts: 612 | Registered: Saturday, October 13 2001 07:00
Master
Member # 4614
Profile Homepage #20
quote:

Installing as an Apache module

You need to insert these two lines to your Apache httpd.conf configuration file to set up the PHP module for Apache 2.0: Example 6-6. PHP and Apache 2.0 as Module

# For PHP 4 do something like this:
LoadModule php4_module "c:/php/php4apache2.dll"
# Don't forget to copy the php4apache2.dll file from the sapi directory!
AddType application/x-httpd-php .php

# For PHP 5 do something like this:
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php

# configure the path to php.ini
PHPIniDir "C:/php"


Note: Remember to substitute the c:/php/ for your actual path to PHP in the above examples. Take care to use either php4apache2.dll or php5apache2.dll in your LoadModule directive and not php4apache.dll or php5apache.dll as the latter ones are designed to run with Apache 1.3.x.


I think we're really getting to the root of the problem here. I don't really have a httpd.conf file. I have two text files in the \conf directory labeled "httpd" and "httpd.default." And if I'm supposed to insert those lines into one of those files, where?

Sorry if I'm being sluggish on catching on to this here. :cool:

[ Sunday, July 24, 2005 14:38: Message edited by: Mister Maoben ]

--------------------
-ben4808

For those who love to spam:
CSM Forums
RIFQ
Posts: 3360 | Registered: Friday, June 25 2004 07:00
Agent
Member # 1104
Profile Homepage #21
It would really help you if you went and turned file extensions on (Control Panel -> Folder Options -> View -> and uncheck "Hide Extensions for known filetypes"). Then you'll see that the httpd has suddenly become httpd.conf. Edit that file and insert the needed information. In this case, you would put in:

# For PHP 5 do something like this:
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php

# configure the path to php.ini
PHPIniDir "C:/php"
You can put that anywhere in the file.

[ Sunday, July 24, 2005 16:32: Message edited by: RC ]

--------------------
Austrian Alex - Reality Corp.
Posts: 1307 | Registered: Tuesday, May 7 2002 07:00
Infiltrator
Member # 154
Profile #22
At any rate, when you've confirmed it's working (phpinfo), you should mess around in php.ini:

Register globals should be off.
Zend compatiability mode should be off.
Short open tag should be on.
Allow call time pass reference should be on, no matter what the comments say.
Safe mode, off.
Expose PHP, off.
Display errors, on.
arg_seperator.output should be "&".

If you're using PHP5, which I assume you are, you also need to make sure to enable the php_mysql.dll module. Enabling php_gd2.dll also makes sense there too.

[ Monday, July 25, 2005 04:35: Message edited by: Kakakaka ]

--------------------
Inconsistently backward.
SWOH. IM, PATF, ND.
Posts: 612 | Registered: Saturday, October 13 2001 07:00
Master
Member # 4614
Profile Homepage #23
Okay, I typed those lines in, made a .php file in htdocs, and ran it with Internet Explorer under http://localhost/test.php.

But, instead of running the file, a download dialog box came up to download the file. I don't think that's what I wanted...

--------------------
-ben4808

For those who love to spam:
CSM Forums
RIFQ
Posts: 3360 | Registered: Friday, June 25 2004 07:00
Infiltrator
Member # 154
Profile #24
You need to configure .php in httpd.conf.. read the readme files.

--------------------
Inconsistently backward.
SWOH. IM, PATF, ND.
Posts: 612 | Registered: Saturday, October 13 2001 07:00

Pages