Jump to content

Php Free Open Source


mstransky

Recommended Posts

Any Ideas where some free open source kits can be downloaded? I have done alot of javasciptt xml in asp.Now my desired is to pick up on the PHP band wagon. Where could I get some complete open source stuff like portal scripts, simple databases that edit modify add delete, stuff that is done which I can make or break it as I mess around with it? I am a hands on kind of learner, not a book worm. I have already started some PHPstuff and get the jest of one line or one function srcipts, but it is easy to see everything at one time.Thanks for any ideas where to get or go.

Link to comment
Share on other sites

Before anyone answers I am kind of narrowing my example type.I know asp has quicks about VBsricpt and JScript dont get along very well.DOES php have have quarls of mingle diffrent types on the same page like asp does?and has any one seen a simple starter php script to add, delete, modify xml?I wouldlike to take my asp database and rewrite it while looking at a work php code.ThanksPS Then would look at working over to a MySql later while learning mysql and php.

Link to comment
Share on other sites

PHP is one language, so there aren't different kinds of examples not being compatible with each other.As far as XML manipulation goes though, there are different APIs for manipulating XML, and if you look into MSDN, you'll see that ASP.NET has many APIs as well, a lot of which match those found in PHP.In particular, PHP has DOM, which (since it's a standard) is exactly the same as in ASP. It also has other XML manipulation APIs, of which the most precious are probably the XSL API (which is the XSLT API for PHP5, so don't try the "XSLT" API - that's for PHP4) and XMLReader, which is a little less featured than ASP.NET's XMLReader API, but sill quite useful and very memory efficient.I don't know of any scripts that operate on XML files (in any language, whether it's PHP or ASP.NET), mostly because XML files are quite different from one dialect to the next. You can see the examples in PHP's manual pages though. They're quite useful.For database modification, I'd suggest you install MySQL and it's GUI tools (MySQL Query Browser in particular), and experiment with that. If that doesn't suit you, PHPMyAdmin is the next best thing, though personally, I don't like it at all.

Link to comment
Share on other sites

PHP is one language, so there aren't different kinds of examples not being compatible with each other.As far as XML manipulation goes though, there are different APIs for manipulating XML, and if you look into MSDN, you'll see that ASP.NET has many APIs as well, a lot of which match those found in PHP.In particular, PHP has DOM, which (since it's a standard) is exactly the same as in ASP. It also has other XML manipulation APIs, of which the most precious are probably the XSL API (which is the XSLT API for PHP5, so don't try the "XSLT" API - that's for PHP4) and XMLReader, which is a little less featured than ASP.NET's XMLReader API, but sill quite useful and very memory efficient.I don't know of any scripts that operate on XML files (in any language, whether it's PHP or ASP.NET), mostly because XML files are quite different from one dialect to the next. You can see the examples in PHP's manual pages though. They're quite useful.For database modification, I'd suggest you install MySQL and it's GUI tools (MySQL Query Browser in particular), and experiment with that. If that doesn't suit you, PHPMyAdmin is the next best thing, though personally, I don't like it at all.
Thank you very much I hate having to put time towards something that will be outdate or already is, then when you speand so much time trying to find out issues they say you should have do this or used that. Then you still find out you are still very very far behind.I found this link for php and xml and have been messing with it for the pass 40 minutes, --- Q. what would your opionin on that be? ---http://www.sitepoint.com/article/management-system-php/I think this will help me add, edit delete, modify xml tables and records. AS LONG AS I can see how PHP connectes, adds, edits, etc... I can then remake the code aournd my exsisting xml databases and xslt dashboards.I will just rewrite my asp into php which called the xml & xsl into hmtl.I would like to rewrite my portal asp/xml into php, but i am willing to look at a pre php protal with mysql and see it run and try and mess with it to see if I can add on my options unto its exsisting setup. I believe I will make the migration to php, reason is many my host providers have many diffrent servers, and you know how diffrent serverss have many diffrent free ad ons which you just click and unload to your web location.Well since I pick windows servers, I kind of have some great things but miss out on other great ad ons.anyway, I will also look up GUI tools, I have alot of rework to do. and have to translate a lot of VBscript and JScript in asp to php.
Link to comment
Share on other sites

DOM in PHP5 is very different than the one in PHP4, so take that article with a grain of salt.The rest of the stuff mentioned hasn't changed that much from PHP4, but there are still changes, so if you can find a PHP5 article, that would certainly be better.Like I said, if you've used DOM or XMLReader in ASP.NET, you use DOM in the exact same sence in PHP. The biggest change would be changing from "." to "->". If you've used XSLT, making XSLT work is not exactly the same, but is still easy. Look at XSLTProcessor::transformToXML() for an example.There are various PHP APIs for DB communication, and for MySQL, there are at least three - the MySQL extension, the MySQLi extension, and the PDO extension. I'd personally reccomend the MySQLi, as its the most recent, most stable, and most full featured PHP extension. The MySQL extension is older, and as such, it doesn't support newer features of MySQL (like mutliple queries, to name one), and it's slower. PDO is also new, fast, well featured and it makes swapping between MySQL and MS SQL databases (as well as others) easy, but for the sake of portability, it sacrifices some of MySQL's features (like the mentioned multiple queries), some of which are available at other DBs as well. In addition, it's harder to find it enabled on hosts than MySQLi. Then again, MySQLi is also hard to find on some hosts, but such hosts would (most of the time) be willing to turn MySQLi on for you.See the mysqli::query() function for examples on how to connect to a database and perform a query against it with PHP.P.S. Let me remind you that DOM in any language (PHP not being an exception) is still DOM. It's still a RAM hog, especially noticeable on large files like yours. Since you have a new language at your hands, consider this also your chance for trying out some new approaches, like combining XML with DBs in various fashions.

Link to comment
Share on other sites

DOM in PHP5 is very different than the one in PHP4, so take that article with a grain of salt.The rest of the stuff mentioned hasn't changed that much from PHP4, but there are still changes, so if you can find a PHP5 article, that would certainly be better.Like I said, if you've used DOM or XMLReader in ASP.NET, you use DOM in the exact same sence in PHP. The biggest change would be changing from "." to "->". If you've used XSLT, making XSLT work is not exactly the same, but is still easy. Look at XSLTProcessor::transformToXML() for an example.There are various PHP APIs for DB communication, and for MySQL, there are at least three - the MySQL extension, the MySQLi extension, and the PDO extension. I'd personally reccomend the MySQLi, as its the most recent, most stable, and most full featured PHP extension. The MySQL extension is older, and as such, it doesn't support newer features of MySQL (like mutliple queries, to name one), and it's slower. PDO is also new, fast, well featured and it makes swapping between MySQL and MS SQL databases (as well as others) easy, but for the sake of portability, it sacrifices some of MySQL's features (like the mentioned multiple queries), some of which are available at other DBs as well. In addition, it's harder to find it enabled on hosts than MySQLi. Then again, MySQLi is also hard to find on some hosts, but such hosts would (most of the time) be willing to turn MySQLi on for you.See the mysqli::query() function for examples on how to connect to a database and perform a query against it with PHP.P.S. Let me remind you that DOM in any language (PHP not being an exception) is still DOM. It's still a RAM hog, especially noticeable on large files like yours. Since you have a new language at your hands, consider this also your chance for trying out some new approaches, like combining XML with DBs in various fashions.
I understand clearly, I am just having fun fun fun, I have been doing alot of cut an paste and getting some to work, and others failling and when they fail. 1) the screen just does not go blank, but errors and lets everyone see were in the weblocation of the file or command which failed.2) getting errors where I have to find or add more files likephp.iniI am instructed to add command lines to php.ini;[php_DOMXML];extension=php_domxml.dllahhhh! the fun again!!!!!now is that php.ini like an global.asa file?Do I just do it the same way?
Link to comment
Share on other sites

php.ini is the PHP config file, located in the same directory as the PHP binaries. I haven't used ASP, so I don't know what global.asa does.It's probably just telling you to enable the php_domxml extension - do that by uncommenting the extension=php_domxml.dll line.You can hide errors in your production scripts, but they are useful for debugging :) what do they say?

Link to comment
Share on other sites

Let's get clear on this - do you have PHP4 or PHP5? There are many differences between the two. Probably as much as between ASP classic and ASP.NET 2.0.You can find out your version by creating a new file (let's call it phpinfo.php; it can be called whatever you like) with this contents:

<?php phpinfo(); ?>

Run that file, and at the top, there should be the version number. This file also contains some useful information, like the extensions that have been loaded.If you use PHP5, DOM should be loaded already, as it's part of the core. Search for "dom", and you should then see a "dom" header with a table below it like this:

DOM/XML enabled DOM/XML API Version 20031129 libxml Version 2.6.32 HTML Support enabled XPath Support enabled XPointer Support enabled Schema Support enabled RelaxNG Support enabled
(possibly with different numbers, but still with everything enabled)If you use PHP4, stop using it right now. If its on your own computer, get PHP5 and install it. If it's on a host, ask them if/how you can use PHP5, and if there's no way (and they aren't willing to make it work), get a new host.... PHP4 is just terrible when it comes to XML manipulation, doesn't support the MySQLi extension, has a lot of missing OOP features (exceptions, to name one), etc.As for php.ini, it's PHP's configuration file. I too haven't worked with ASP.NET to know what global.asa does. You edit php.ini as a text file. Uncommenting a line is done by removing the ";" in front of it (and commenting is obviously done by adding one). In PHP5, DOM and XMLReader don't need to be loaded as extensions. They're part of the core. The XSL extension has to be loaded though, and so has to be the MySQLi extension. If you host PHP(5!!!) at your own computer, you do that by uncomment the lines:
extension=php_xsl.dll

and

extension=php_mysqli.dll

respectively. And make sure you also set the extensions directory to the folder where you've installed PHP + ext, like if you've installed PHP in "D:\PHP", find the line starting with

extension_dir =

and change the whole line to:

extension_dir = "D:\PHP5\ext"

If you're on a host, only they'll have access to php.ini (or at least only they should...), so you'll have to ask them to enable those extensions if they aren't already enabled.

Link to comment
Share on other sites

thanks for the insightI pulled up my server info files and versionPlatform Type Windows 2003 Server Enterprise MySQL Version MySQL Version 5.0.45 Perl Version Perl 5.8.8 PHP Version PHP 4.4.7 Windows Mail Components AspEmailAspUpload Installed Perl Modules - too many to listInstalled Pear Modules - too many to list------------------------------I will shoot them a ticket on the php 5 to be enabled.

Link to comment
Share on other sites

php question.have been messing with a php which has a variable in the stringexample:a list of xml file are seen in a directory, once you click on a file to edit your next page loadsurl looks like thishttp://........./editArticle.php?file=test.xmlas this PHP runs ....session code......function extractText($array){ if(count($array) <= 1){ //we only have one tag to process! for ($i = 0; $i<count($array); $i++){ $node = $array[$i]; $value = $node->get_content(); } return $value; } } ....session code redirect.....if ($file == ""){ echo "<h2>You didn't choose a file to edit!</h2>"; echo "<a href=\"adminindex.php\">Go back to index and choose a file</a>"; exit;} else { $filename = "./xml/".$file; $xml = domxml_open_file($filename); $root = $xml->root(); $id = $root->get_attribute("id");.....rest of the php code......problem I can clearly see that editArticle.php?file=test.xml would return thatfile=test.xmlBUT when the code reaches if ($file == ""){ echo "<h2>You didn't choose a file to edit!</h2>"; echo "<a href=\"adminindex.php\">Go back to index and choose a file</a>"; exit;it html code out put DOES display "Go back to...." as if the php could not see the varible from the url?Thanks for any correction.

Link to comment
Share on other sites

Variables from the querystring appear in the $_GET superglobal array, so your filename would be accessible through $_GET['file']. However, the $_GET superglobal is not passed from page to page after redirection - you need to use sessions for that.

Link to comment
Share on other sites

Variables from the querystring appear in the $_GET superglobal array, so your filename would be accessible through $_GET['file']. However, the $_GET superglobal is not passed from page to page after redirection - you need to use sessions for that.
ahhh, ok I get it, so php does use a file the same way asp uses global.asaI guess it would have been nice if more of the php download scripts would actually have complete scripts. now I will have to look into that also.ThanksI guess I will have to be more careful when a site says grab the complete code or kit it really might not be a COMPLETE kit. lol.
Link to comment
Share on other sites

global.asa in ASP is a file that every script in an application will include, so the declarations given in global.asa will be available to all scripts in the application, and it can also define application and session events and their handlers. PHP doesn't have an event model like ASP does, and it doesn't have a generic global include file that automatically gets included by everything. In PHP you can include whatever files you want, you can make your own global include files that define variables and functions and classes and things and include whichever files you want to use on any script. In PHP you have to tell it which file to include though, it doesn't look for a file with a common name and automatically include it.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...