PHP Knowledge Base Update -- July 4th, 1999
[email protected] (Nathan Wallace) Mon, 5 Jul 1999 04:04:43 -0500
| Newsgroups | php.kb |
|---|---|
| Message-ID | <[email protected]> |
Adrian Teasdale today suggested the idea of PHP user groups. "I have come to PHP from Cold Fusion where users have setup their own groups and I have found this very useful for bouncing ideas, meeting people with the same/similar vision and it's also another excuse to meet up with a bunch of people and have a drink." Drop him a line at [email protected] if you are in the UK and interested in starting a group... Happy 4th July from Down Under to all the Yanks on the list. <g> Cheers, Nathan ------------------------------------------------------------ How much memory do I need to compile PHP? Why do I get a "virtual memory exhausted" error in bison when compiling? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/380 ------------------------------------------------------------ mike dombrowski, Rasmus Lerdorf Compiling PHP requires a reasonable amount of memory. Here is an example error message from a machine with only 8MB of RAM and 8MB of swap memory. ha:/tmp/php-3.0.11# make gcc -g -O2 -O2 -fpic -I. -I. -I/usr/local/apache/include -I/tmp/include -c language-parser.tab.c -o language-parser.tab.o /usr/lib/bison.simple: In function `phpparse': /usr/lib/bison.simple:692: virtual memory exhausted make: *** [language-parser.tab.o] Error 1 ha:/tmp/php-3.0.11# If you are having memory problems when compiling you may like to try installing pre-compiled PHP binaries. ------------------------------------------------------------ How can I get the MX records for a domain from inside PHP? How can I get DNS records for a domain or IP from inside PHP? Can I get the IP address for a known host in PHP? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/382 ------------------------------------------------------------ Stephen Benjamin Network Functions: http://www.php.net/manual/ref.network.php3 gethostbyaddr - Get the Internet host name corresponding to a given IP address: http://www.php.net/manual/function.gethostbyaddr.php3 gethostbyname - Get the IP address corresponding to a given Internet host name: http://www.php.net/manual/function.gethostbyname.php3 gethostbynamel - Get a list of IP addresses corresponding to a given Internet host name: http://www.php.net/manual/function.gethostbynamel.php3 checkdnsrr - Check DNS records corresponding to a given Internet host name or IP address: http://www.php.net/manualfunction.checkdnsrr.php3 getmxrr - Get MX records corresponding to a given Internet host name: http://www.php.net/manual/function.getmxrr.php3 ------------------------------------------------------------ How many times can or should I call pconnect? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/385 ------------------------------------------------------------ Rasmus Lerdorf You can have as many *_pconnect() calls as you want. If PHP sees you are trying to connect to the database with *exactly* the same parameters as an already established connection, then your *_pconnect() call won't do anything. It will just return the connection identifier of the already established connection. So you should make a single call to *_pconnect() in each script where you require the use of a database. If a connection already exists the call will do nothing, if it doesn't exist then a connection will be established. ------------------------------------------------------------ Can I configure PHP on a per virtual host basis? Can I configure PHP on a per directory basis using .htaccess? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/386 ------------------------------------------------------------ Jon Parise In Apache, you can add PHP directives within a <VirtualHost> block if you like, or you can add them to an .htaccess file in the top of your PHP document root. These directives are the same as the php3.ini directives except they are prefixed with 'php3_'. For example, <VirtualHost my.host.com> DocumentRoot /usr/local/apache/htdocs/my.host.com php3_include_dir /usr/local/apache/php3 </VirtualHost> For a complete list of configuration directives see: http://www.php.net/manual/configuration.php3 ------------------------------------------------------------ What's the easiest way to move MySQL data between servers? How can I move my MySQL tables and data up to my web host? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/388 ------------------------------------------------------------ Chad Cunningham The easiest way is to just dump it and import it. On you development machine: mysqldump database_name > dump.sql Then ftp dump.sql up to your web host and import the data into the MySQL database there: mysql -p ... database_name < dump.sql ------------------------------------------------------------ I have a form with 4 buttons, how can I run a different PHP script for each? Can I run different PHP scripts from the same form submission? How can I make change the action URL for a form using Javascript? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/390 ------------------------------------------------------------ Frank Kooger, John Coggeshall A single HTML form can have multiple buttons, but it can only ever have one action attribute. That means that every submission from that form must run that single action URL. You can run different PHP scripts for different buttons by using include(). http://www.php.net/manual/function.include.php3 Just create a single PHP script which contains a conditional statement, testing for which button was pressed. You can then just include a different PHP script for each of the possibilities. You can do somthing like this: <FORM ACTION="formproc.php3"> <INPUT TYPE="submit" NAME="ButtonA" VALUE="Button 1"> <INPUT TPYE="submit" NAME="ButtonB" VALUE="Button 2"> </FORM> formproc.php3 <?php if(isset($ButtonA)) { // code and html for A include("scriptA.php3"); } if(isset($ButtonB)) { // code and html for B include("scriptB.php3"); } ?> You can also cause different requests to be sent to the server (ie: the correct one for each button) using Javascript. Use Javascript and 4 buttons of type <input type=button> instead of <input type=submit>. Then you end up with four Javascript functions like: function gotopage1() { document.forms[0].action="some.phtm?someparm=somevalue"; document.master.submit(); }