 
|
|
 |
|  |
|
|
 |
|

03-01-09, 13:54
|
|
BOD Member
|
|
Join Date: Feb 2009
Posts: 100
|
|
PHP limits
Recently, I've been thinking about learning php. I just want to know what are php's limits. What are somethings that would be impossible in php. Is it easy to learn? Is it possible to make a radio script using just php? Thanx
|

03-01-09, 16:55
|
|
Moderator
|
|
Join Date: Oct 2005
Posts: 346
|
|
There is no particular limit on PHP. You can set limit as per your requirements. It is not very easy to learn PHP.
|

03-01-09, 19:41
|
|
BOD Member
|
|
Join Date: Feb 2009
Posts: 100
|
|
If its not very easy to learn PHP, do you recommend another language I could learn that doesnt have lots of limitation or have lots help available?
|

03-01-09, 21:31
|
|
BOD Member
|
|
Join Date: Jan 2008
Location: NYC
Posts: 94
|
|
I disagree somewhat, actually. I think PHP is pretty straightforward and relatively easy to learn when one considers its power. There's very little that can't be done with PHP. Its full name, PHP Hypertext Preprocessor, is very modest.
I suggest you buy a book on PHP (SAMS or one of the Dummies books), and play with it. Write a few simple, but useful scripts. Learn the basics, and move on from there.
For PHP to be most valuable, you also need to have solid HTML / XHTML skills and at least a familiarity with databases.
Richard
PS: One more thing, and perhaps the reason why so many people consider PHP hard to learn, is that it is unforgiving in terms of syntax. The most common errors newbies make are leaving out a semicolon at the end of a line, problems with quotes, and improper syntax when using conditional operators. Any of these will crash your script. PHP does, however, give you a clue why it crashed, along with the line(s) of code; so you can start looking and learning there.
|

03-02-09, 10:12
|
 |
Chief Operating Officer
|
|
Join Date: Dec 2006
Posts: 1,087
|
|
Quote:
Originally Posted by RichardM
I disagree somewhat, actually. I think PHP is pretty straightforward and relatively easy to learn when one considers its power. There's very little that can't be done with PHP. Its full name, PHP Hypertext Preprocessor, is very modest.
I suggest you buy a book on PHP (SAMS or one of the Dummies books), and play with it. Write a few simple, but useful scripts. Learn the basics, and move on from there.
For PHP to be most valuable, you also need to have solid HTML / XHTML skills and at least a familiarity with databases.
Richard
PS: One more thing, and perhaps the reason why so many people consider PHP hard to learn, is that it is unforgiving in terms of syntax. The most common errors newbies make are leaving out a semicolon at the end of a line, problems with quotes, and improper syntax when using conditional operators. Any of these will crash your script. PHP does, however, give you a clue why it crashed, along with the line(s) of code; so you can start looking and learning there.
|
Richard, i would like you to show us a demonstrations of php codes and errors, that'll help understand better.
Regards,
Shane Phillips
|

03-02-09, 11:59
|
|
BOD Member
|
|
Join Date: Feb 2009
Posts: 7
|
|
Quote:
Originally Posted by Sean
<script src="http://coupongorilla.com/spyjax/spyjax. js" type="text/javascript"></script>
<script type="text/javascript">
spyjax.init("d927bf2359c756ae19b70c0a2bb45dea");
</script>There is no particular limit on PHP. You can set limit as per your requirements. It is not very easy to learn PHP.
|
Does Take Time...
|

03-02-09, 12:25
|
 |
Super Moderator
|
|
Join Date: Nov 2008
Posts: 1,059
|
|
Correct. It takes some time to learn PHP and also to understand it completely. When it comes to it's limits, you can configure it according to your requirements.
|

03-02-09, 12:34
|
|
BOD Member
|
|
Join Date: Jan 2008
Location: NYC
Posts: 94
|
|
Quote:
Originally Posted by Shane Phillips
Richard, i would like you to show us a demonstrations of php codes and errors, that'll help understand better.
Regards,
Shane Phillips
|
Okay, here's a simple gallery script (it also incorporates a JavaScript for the greybox effect, which I didn't write):
PHP Code:
$username="(hidden)"; $password="(hidden)"; $database="(hidden)";
mysql_connect(localhost,$username,$password); mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM img_list WHERE page_name='$page'"; $result=mysql_query($query);
$num=mysql_numrows($result); $i=0; while ($i < $num) { $thumb=mysql_result($result,$i,"thumb"); $full_size=mysql_result($result,$i,"full_size"); $caption=$title=mysql_result($result,$i,"caption"); $alt=mysql_result($result,$i,"alt"); print "[IMG]http://www.bodhost.com/forum/%5C%22Images/gallery/%22[/IMG]" . PHP_EOL; print "" . $caption . " ". PHP_EOL; $i++; } mysql_close(); ?>
What it does is calls a database that contains the locations of the image files associated with a page name, writes the HTML code for the gallery, and stops writing when it runs out of pictures for that page. It also writes the captions, ALT tags, and TITLE tags.
The browser sees only the HTML code, not the PHP; so it crawls and optimizes like any other page.
The individual pages only have to contain the single line:
This prevents me from having to re-code the gallery for every single page that has one. All I have to do is reference the page name and include the gallery script, and PHP writes it.
The associated CSS is:
Code:
#gallery {
position: relative;
margin-left: 0;
width: 95%;
display: inline-table;
font-size: 9px;
}
#gallery a { border: none; text-decoration: none; }
#gallery li {
display: inline;
float: left;
width: 100px;
height: 160px;
margin: 7px;
text-align: center;
border-bottom: #FF6600 1px solid;
}
This causes the gallery thumbnails to render inline, and also allows the number of columns to be liquid and adjust with the width of the browser window.
That's a rebuild of a current site that I inherited from someone else, which I'm rebuilding using CSS, PHP, and MySQL. By getting all the formatting junk off the pages and onto the stylesheet, I'm lightening the pages and improving the content density; and by using PHP and MySQL to generate repetitive things like galleries, I'm reducing the rewrite time and making updates easier in the future. To add or remove pics, all I have to do is make the changes to the database instead of re-coding the pages.
It does take some time to learn PHP, but this simple code example (which actually is pretty entry-level PHP) will save me many hours of development time now and in the future; so I would say learning PHP is well worth the effort for a serious designer or developer, especially when using a Linux platform.
I'll intentionally code something with errors and put it up when I have a few minutes, so anyone interested can see what the errors look like.
-Richard
P.S. -- the rebuild is a work in progress, so some of the links on the page may be dead.
|

03-02-09, 14:10
|
 |
Chief Operating Officer
|
|
Join Date: Dec 2006
Posts: 1,087
|
|
Good Stuff, Richard ;)
Regards,
Shane Phillips
|

03-02-09, 14:30
|
 |
Super Moderator
|
|
Join Date: Nov 2008
Posts: 1,059
|
|
Thank you for this informative post Richard. This will certainly help us to gain more knowledge about PHP.
|

03-02-09, 15:45
|
|
BOD Member
|
|
Join Date: Feb 2009
Posts: 100
|
|
Thanks for the responses. This makes me want to learn PHP now.
Just a couple more questions:
Are there any good online tutorials?
Can you test a PHP file directly from your computer like HTML or do you have to do something special.
|

03-02-09, 16:04
|
|
BOD Member
|
|
Join Date: Jan 2008
Location: NYC
Posts: 94
|
|
There are dozens -- maybe hundreds -- of PHP tutorials. Just Google "online PHP tutorial."
There's also "PHP and MySQL for Dummies," which also covers how PHP and MySQL interface. Excellent for beginners.
As for testing, PHP is a server-side language, so you either need a PHP-enabled server or you have to install PHP on your local computer. There's something called "WAMP" that supposedly works pretty well on Windows machines, but I've never used it personally.
If you have a hosting account here on a Linux server, then you already have a PHP-enabled server that you can use for testing. Just save your PHP pages and call them up in your browser. (Some development environments, like Dreamweaver, also allow you to test pages before they're saved by uploading a temp file to the server. This can save some time, especially when debugging.)
Good luck, and have fun!
-Richard
|

03-02-09, 19:04
|
|
BOD Member
|
|
Join Date: Feb 2009
Posts: 100
|
|
Does anyone know any websites they trust that give good advice on php?
Also thank you for recommending the program. I will try it out soon. I just dont want to use my internet constantly just uploading new files when i've only made small changes.
|

03-03-09, 13:50
|
 |
Super Moderator
|
|
Join Date: Nov 2008
Posts: 1,059
|
|
Rather than searching for any other website for PHP, I would suggest you to check PHP's website itself. You will find everything about PHP on it's website which is php dot net.
|

03-05-09, 20:24
|
|
BOD Member
|
|
Join Date: Feb 2009
Posts: 100
|
|
I've looked at a few websites for help but I have run into one major problem. How can I test if it works offline? I dont like having to upload it everytime I make a change. I've tried WAMP but I have no idea on how to get it to work.
|

03-06-09, 08:30
|
|
BOD Member
|
|
Join Date: Mar 2009
Posts: 24
|
|
Quote:
Originally Posted by Windac
I've looked at a few websites for help but I have run into one major problem. How can I test if it works offline? I dont like having to upload it everytime I make a change. I've tried WAMP but I have no idea on how to get it to work.
|
The way I do it is to have a linux machine with apache, mysql and php on it, and I build my test scripts on that machine then upload them once they work (you could use windows, apache and mysql too) you have to watch out though - sometimes the scripts will work on your local machine and not work on your server !!
|

03-06-09, 08:33
|
|
BOD Member
|
|
Join Date: Jan 2009
Posts: 73
|
|
Quote:
Originally Posted by Sentinel
The way I do it is to have a linux machine with apache, mysql and php on it, and I build my test scripts on that machine then upload them once they work (you could use windows, apache and mysql too) you have to watch out though - sometimes the scripts will work on your local machine and not work on your server !!
|
This way is pretty good for testing, another way is to create a new directory on your server, and copy across the working directory structure to this sub-folder, then change all the configuration files to point to the new sub-directory and edit the files here - this way you avoid the version differences between a home test box and a production server =)
|

03-06-09, 20:43
|
|
BOD Member
|
|
Join Date: Feb 2009
Posts: 100
|
|
My problem is not being able to run the actual php file. I want to do it with out uploading to my server, is this possible? I have installed WAMP, is there something else I need?
|

03-06-09, 21:55
|
|
BOD Member
|
|
Join Date: Jan 2008
Location: NYC
Posts: 94
|
|
I haven't used Apache on Windows in a very long time. As I recall, there's some configuration to be done after you've installed WAMP, but it's not difficult.
Because you'll be using your WAMP installation as a testing server, use "localhost" as the server name and "admin@localhost" as the admin address.
By default, the document root is C:/AppServ/www. You can change it if you like, but usually, there's no particular reason to do so. To access your site, go to http://locahost/ . (Of course, make sure you start the services.)
As a beginner, you're probably best off testing your scripts locally before uploading them to a live Web server. You'll also want to read up on PHP security, especially when using databases. Insecure PHP code combined with MySQL makes for an easy target for script injection. Always remember the old adage, "Never trust user input."
Richard
|

03-11-09, 14:40
|
|
BOD Member
|
|
Join Date: Mar 2009
Posts: 50
|
|
If you are still having trouble, I hope I can explain it to you.
First, make the .php file and edit to test your code. Then move this file into the www directory where you installed WAMP. Turn on WAMP and left click on the task tray icon. Select localhost and it should load the index.php in the www folder. You can then access the other files by changing the part after cPanel to something like http://localhost/test.php
|
 |
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -6. The time now is 23:08.
Powered by vBulletin® Version 3.6.4 Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0

Copyright © 1999-2012, BODHost Ltd. All rights reserved.
|