[PHP] Re: unable to load php_gd2.dll
Check a conformity of php and gd versions. I had same problem, I donload Nusphere Techplat and took its php_gd2.dll. I can send u one if u want ddiffa [EMAIL PROTECTED] ???/ ? ?: news:[EMAIL PROTECTED] Okay I at loss. I have tried but i can seem to get the php_gd2.dll to work properly. Any help this is what i have done so far. I have in my php.ini file, ; Directory in which the loadable extensions (modules) reside. extension_dir = C:\PHP\extensions I have also uncommented the extension = php_gd2.dll I have in the c:\php\extension folder the php_gd2.dll I have restarted IIS but still nothing I am using Window XP $ 2000 with IIS 5.0 but still nothing Please help Disieyi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: unable to load php_gd2.dll
ddiffa wrote: Okay I at loss. I have tried but i can seem to get the php_gd2.dll to work properly. Any help this is what i have done so far. I have in my php.ini file, check phpinfo() that you are using the right php.ini ; Directory in which the loadable extensions (modules) reside. extension_dir = C:\PHP\extensions I have also uncommented the extension = php_gd2.dll I have in the c:\php\extension folder the php_gd2.dll I have restarted IIS but still nothing I am using Window XP $ 2000 with IIS 5.0 but still nothing what means 'nothing'? does it start? or does it report any errors? what says phpinfo() about gd? -- Sebastian Mendel www.sebastianmendel.de www.sf.net/projects/phpdatetime | www.sf.net/projects/phptimesheet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Converting [and] to XML format- help/advise requested
Dotan Cohen wrote: Hi gurus. I'm having fun replacing the text within [ and ] to XML format on 4000+ files on a windows XP machine. I installed php (and an apache server) on the machine because it is the only language the I am remotely familiar with. I want and text that is with [ and ] to be enclosed with note and /note. Going through the archives I found this nice regex (I changed it a bit- I hope that I didn't break anything important) that fits into str_replace: str_replace(/[([a-zA-Z]+?)]/, note.$what was_inside_the_parethesis./note, $string); str_replace doesnt support regular expressions http://www.php.net/str_replace what you need is preg_replace() http://www.php.net/preg_replace But how on sweet mother Earth do I get the $what was_inside_the_parethesis variable to stick into the note tags? I tried functions that would remove the [ and ], then do $new_str=note.$what was_inside_the_parethesis./note; and then replace the whole [$what was_inside_the_parethesis] with $new_str. I did get that far. preg_replace( '/\[([^\]]+)\]/', 'note\1/note', $string); Now the catch! If $what_was_inside_the_parethesis contains the word 'algebra' then I want nothing returned- in other words [$what was_inside_the_parethesis] should be cut out and nothing put in it's place. I added an if function in there that checked the presence of the word algebra, but it ALWAYS returned blank. preg_replace( '/\[(algebra|([^\]]+))\]/', 'note\2/note', $string); just to mention, you need only the second example, the first ist just to explain the step toward the final ocde. The code works great for [] tags that do not contain the word algebra. If the word algebra is alone between the tags then it returns note/note, which I can easily remove with one more line of code. But if the word algebra appears with another word, then it is converted to a note just as if it did not contain the word. $search = array( '/\[[^\]*algebra[^\]*\]/', '/\[([^\]]+)\]/', ); $replace = array( '', 'note\1/note', ); preg_replace( $search, $replace, $string); -- Sebastian Mendel www.sebastianmendel.de www.sf.net/projects/phpdatetime | www.sf.net/projects/phptimesheet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Retrievable weather service info?
Murray @ PlanetThoughtful wrote: Hi All, Just wondering if anyone knows of a free weather service that can be interrogated by PHP for information such as current temperature for a range of cities around the world? iirc, weather.com provides a XML feed of such information. Free signup. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Retrievable weather service info?
How about: http://www.capescience.com/webservices/globalweather/index.shtml -- Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Retrievable weather service info?
Hi Murray Ive managed to get the local weather in cape town or for any airport that has a ITIA code. the webservice is provide by: http://www.capescience.com/webservices/globalweather/index.shtml you will need to get nusoap from sourceforge to make use of the webservice. regards clive -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Apple software updater kills php cli ?
Hi, I had made a feedback complaint to Apple without any reply, I was wondering if anyone has had any issues with their php cli crapping out whenever an apple update occurs under OSX ? It seems to revert back to php 4.3 or whatever is the default in the base system. I run a php5 system. Here is the output running the php cli that randomly occurs after an update until i recompile ! dyld: php Undefined symbols: _OnUpdateLong _OnUpdateString _compiler_globals _executor_globals _sapi_globals _sapi_module _zend_error_cb _zend_extensions _zend_ini_boolean_displayer_cb Trace/BPT trap -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Compiling problem (apxs)
Hello, I have a RedHat system running Apache and PHP Version 4.3.2. These were pre-installed Red Hat packages. Things worked nicely. But I needed to recompile PHP, because I need Oracle support, and this package wasn't compiled with --with-oracle=/path/to/oracle/home/dir --with-oci8=/path/to/oracle/home/dir So I downloaded the source, and tried to setup the ./configure with the same options as the existing version, plus the two oracle lines. But the compile fails with checking for Apache 1.x module support via DSO through APXS... Sorry, I was not able to successfully run APXS. Possible reasons: 1. Perl is not installed; 2. Apache was not compiled with DSO support (--enable-module=so); 3. 'apxs' is not in your path. Try to use --with-apxs=/path/to/apxs The output of apxs follows ./configure: line 3169: apxs: command not found configure: error: Aborting What's odd is that when I look at phpinfo for the running PHP, it says it was compiled like that. But it's true that apxs does not exist on the system. Do I have to recompile Apache as well? When I tried it without apxs, it compiled and installed fine, but Apache was still loading the old libphp4.so. So the Apache version was still without Oracle. All I'm trying to do is get PHP running with Oracle support. Thanks Shane -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: unable to load php_gd2.dll
Sebastian Mendel wrote: ; Directory in which the loadable extensions (modules) reside. extension_dir = C:\PHP\extensions I have also uncommented the extension = php_gd2.dll I have in the c:\php\extension folder the php_gd2.dll I have restarted IIS but still nothing I am using Window XP $ 2000 with IIS 5.0 but still nothing what means 'nothing'? does it start? or does it report any errors? what says phpinfo() about gd? Well, this is the error i get PHP Warning: PHP Startup: Unable to load dynamic library 'c:/windows/system32\php_gd2.dll' - The specified module could not be found. in Unknown on line 0 I have also tried pointing the extension_dir to the c:/php/extension, but it still give the same error did you check your Windows System Eventviewer? this error doesnt mean that 'php_gd2.dll' can not found, but that another dll, required by php_gd2.dll can not be found. -- Sebastian Mendel www.sebastianmendel.de www.sf.net/projects/phpdatetime | www.sf.net/projects/phptimesheet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checkboxes From Intersection Redux
Hopefully I understand your question correctly. You have this SQL: $media_query = 'SELECT media_id,media_name FROM media GROUP BY media_name'; And For every media_id which is associated with $cartoon in the table media_art, check the box; for all others leave them unchecked. The problem is, the SQL you have is not returning every media_id (because you're grouping on media_name). I wonder if you truly need to group on media_name. I would assume that media_name is unique in the media table. If it is not, then you need to rethink your table structure. If you group on media_name and there are duplicate media_names, you can have data like this: media_id media_name 4Name1 16 Name1 Grouping by media_name as in your query above will produce a line like: media_idmedia_name 4 Name1 You then output this to check boxes and use those to set the relation to art and media. But what's the difference between media_id 4 and media_id 16? In this case, if the database always returns the group by this way, you would never set the media_id 16. If there is a distinct difference between media_names with different ids, then I think you probably need to make some changes. That being said, if you do not need to group by media_name, then you can simply do something like this: select media.media_id, media.media_name, media_art.art_id, from media left join media_art on media_art.media_id=media.media_id and media_art.art_id=$cartoon['art_id'] Which would return a table like this if $cartoon['art_id']=15: media_idmedia_name art_id 4 Name1 NULL 8 Name2 15 12 Name3 NULL 16 Name4 15 17 Name5 NULL 18 Name6 NULL You could then test the output of art_id: $checkbox_media[] = input type='checkbox' name='media_types[]' value='{$media_rows['media_id']}' .(rows['art_id']==$cartoon['art_id']? checked:)./{$media_rows['media_name']} ; HTH kgt Jack Jackson wrote: Hi, With your help I got some checkboxes generated the other day for a form. I would like some help getting a similar problem solved. I am now making a form to edit db entries made in the previous form. I have three tables involved: art, media and media_art. I need to show checkboxes for all available media. For the chosen record ($cartoon, which equals an art_id selected by the user) I must also go into the media_art table, and where the selected art ID has a corresponding media_id, display that media_id's media_name as a checked box. TABLE media: media_id media_name 1 ink 2 pencil 3 watercolor 4 gauche 5 watercolor pencil To find out the art_id of the chosen record, the user is selecting from a dropdown box in the form. I'm doing queries like this to make a publisher dropdown in a similar vein: $query = SELECT * FROM art WHERE art.art_id = '$cartoon'; $publisher_query = 'SELECT * FROM publisher'; $result = mysql_query($query); $publisher_result = mysql_query($publisher_query); while ($rows = mysql_fetch_assoc($result)){ $publisher_dropdown = 'select name=publisher_id'; while ($pub = mysql_fetch_assoc($publisher_result)){ $publisher_dropdown .= 'option value=' . $pub['publisher_id']; if ($pub['publisher_id'] == $rows['publisher_id']){ $publisher_dropdown .= ' selected '; } $publisher_dropdown .= '' . htmlentities($pub['publisher_name']); } $publisher_dropdown .= '/select'; } I now need to formulate how to make the checkboxes similarly. The original setup to make the checkboxes was : $media_query = 'SELECT media_id,media_name FROM media GROUP BY media_name'; $media_result = mysql_query($media_query); $checkbox_media = array (); $media_types = array(); while ($media_rows = mysql_fetch_assoc($media_result)){ $checkbox_media[] = input type='checkbox' name='media_types[]' value='{$media_rows['media_id']}' /{$media_rows['media_name']} ; } Those which were checked were inserted into media_art thusly: media_id art_id 31 41 51 What I want to do is say For every media_id which is associated with $cartoon in the table media_art, check the box; for all others leave them unchecked. How can I do this? Thanks very much in advance, Jack -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: retreiving postal/zip codes with PHP
I. Gray wrote: Hi. I was wandering whether anyone knew how i can use php to retrieve info from a postal code (probably mainly in the UK) so that when a person enters the post code it comes up with the address or I can do other things with the info. Is there a php class that can do this? Would I need to use a database of postal info? If so are there any (preferably free) ones? Thanks everyone. The Royal Mail, I don't think will stop charging for the service. I wish there was a decent world wide database that was free to use. Many websites out there use some kind of database. The website www.faxyourmp.co.uk uses one, and since they don't make any money from this (well I can't see how they can) then will they be paying for a post code database? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Image upload form
Hi, After a disastrous first attempt (which uploaded images but only by chance) it was suggested I rework the entire thing. This one seems to check the file against getimagesize and if that doesn't prove false, check the type and make the extension then rename the file. But the moving part is not working, and it does not kick back any error, it just fails. Can anyone tell me what I am doing wrong, and also if this is sufficient to a) upload images safely and b) protect against tampering? Thanks in advance, JJ ?php error_reporting(E_ALL); $uploaddir = images/jpg/test/; // print_r($_FILES); $local_file = $_FILES['userfile']['tmp_name']; if (sizeof($local_file)) { //try to get image size; this returns false if this is not an actual image file. $image_test = getimagesize($local_file); if ($image_test !== false) { $mime_type = $_FILES['userfile']['type']; switch($mime_type) { case image/jpeg: $pext = 'jpg'; break; case image/tiff: $pext = 'tif'; break; default: echo The file you are trying to upload is an image, but it is not a tif or jpeg and therefore unacceptable.; } } else { echo The file you are trying to upload is not a valid image file; } $main_image = md5(date(l-F-j-Y i:s)).'.'.$pext; move_uploaded_file($main_image,$uploaddir); } ? form enctype=multipart/form-data action=?php echo $_SERVER['PHP_SELF']; ? method=POST input type=hidden name=MAX_FILE_SIZE value=30 / !-- Name of input element determines name in $_FILES array -- Cartoon: input name=userfile type=file / input type=submit value=Upload File / /form -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: retreiving postal/zip codes with PHP
I. Gray wrote: The Royal Mail, I don't think will stop charging for the service. I wish there was a decent world wide database that was free to use. I do have a start http://home.lsces.co.uk/ibWebAdmin_0_98/FirebirdFederationDataArchive.html I'd like to put the full UK one in, but apart from not having the bandwidth, I'll probably also get letters ;) -- Lester Caine - L.S.Caine Electronic Services -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: retreiving postal/zip codes with PHP
I. Gray wrote: The Royal Mail, I don't think will stop charging for the service. I wish there was a decent world wide database that was free to use. I do have a start http://home.lsces.co.uk/ibWebAdmin_0_98/FirebirdFederationDataArchive.html I'd like to put the full UK one in, but apart from not having the bandwidth, I'll probably also get letters ;) If anybody does have additional information that can go in -- Lester Caine - L.S.Caine Electronic Services -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Apache fails to start (oracle path problem?)
Hello, I'm having trouble compiling and running PHP with oracle support. I was able to compile with the appropriate configure script, but only after I set my Oracle environment variables in my shell. That was no problem. The problem is, when Apache goes to load the php module, it fails, because it can't find the oracle library. Interactively I had to do this... export LD_LIBRARY_PATH=$ORACLE_HOME/lib But Apache.. Starting httpd: Syntax error on line 207 of /etc/httpd/conf/httpd.conf: Cannot load /usr/lib/httpd/modules/libphp4.so into server: libclntsh.so.10.1: cannot open shared object file: No such file or directory [FAILED] Not sure how I could set that for Apache? Shane -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] gzcompress in 4.3.7?
I am working with a class to create zip files and the class requires gzcompress(). An undefined function error is thrown (Fatal error: Call to undefined function: gzcompress() in /var/li...) yet the TFM says that gzcompress is available in (PHP 4 = 4.0.1, PHP 5). I am running 4.3.7 on this particular server. I am searching Google and the php web site to no avail. Has anyone else here had the problem? Does anyone know of anything I should look for? Harumphmy day had been sailing along reasonably smoothly. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: gzcompress in 4.3.7?
[snip] I am working with a class to create zip files and the class requires gzcompress(). An undefined function error is thrown (Fatal error: Call to undefined function: gzcompress() in /var/li...) yet the TFM says that gzcompress is available in (PHP 4 = 4.0.1, PHP 5). I am running 4.3.7 on this particular server. I am searching Google and the php web site to no avail. Has anyone else here had the problem? Does anyone know of anything I should look for? Harumphmy day had been sailing along reasonably smoothly. [/snip] Never mind. I just found out that the network admin recompiled PHP on this server without zlib. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: unable to load php_gd2.dll
; Directory in which the loadable extensions (modules) reside. extension_dir = C:\PHP\extensions I have also uncommented the extension = php_gd2.dll I have in the c:\php\extension folder the php_gd2.dll I have restarted IIS but still nothing I am using Window XP $ 2000 with IIS 5.0 but still nothing what means 'nothing'? does it start? or does it report any errors? what says phpinfo() about gd? Well, this is the error i get PHP Warning: PHP Startup: Unable to load dynamic library 'c:/windows/system32\php_gd2.dll' - The specified module could not be found. in Unknown on line 0 I have also tried pointing the extension_dir to the c:/php/extension, but it still give the same error did you check your Windows System Eventviewer? this error doesnt mean that 'php_gd2.dll' can not found, but that another dll, required by php_gd2.dll can not be found. I checked the even view but no help there. What dll do you think i would need? Please I appreciate your help. extension_dir = c:\php\extensions\ http://www.php.net/manual/en/install.windows.extensions.php Please do not forget the last backslash -- Sebastian Mendel www.sebastianmendel.de www.sf.net/projects/phpdatetime | www.sf.net/projects/phptimesheet -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: gzcompress in 4.3.7?
Jay Blanchard wrote: [snip] I am working with a class to create zip files and the class requires gzcompress(). An undefined function error is thrown (Fatal error: Call to undefined function: gzcompress() in /var/li...) yet the TFM says that gzcompress is available in (PHP 4 = 4.0.1, PHP 5). I am running 4.3.7 on this particular server. I am searching Google and the php web site to no avail. Has anyone else here had the problem? Does anyone know of anything I should look for? Harumphmy day had been sailing along reasonably smoothly. [/snip] Never mind. I just found out that the network admin recompiled PHP on this server without zlib. snip See, if you would have looked at your phpinfo() you would have known this. ;) *ducks* -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] RE: gzcompress in 4.3.7?
[snip] Harumphmy day had been sailing along reasonably smoothly. [/snip] Never mind. I just found out that the network admin recompiled PHP on this server without zlib. snip See, if you would have looked at your phpinfo() you would have known this. ;) *ducks* [snip] *throws* Well, there is that whole last time I looked at it, about a week ago thing it was there because I wanted to confirm its existence for the little project I am trying to complete this week. *throws again, just because* :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php/osx and firebird
I have a windows machine with Firebird and the default database. I've configured another machine with Apache and PHP. I want to write PHP scripts to remotely access the Firebird database. I followed the instructions at: http://us3.php.net/ibase I changed the php.ini to enable the php_interbase.dll and the php_gd2.dll by commenting out the two lines under Windows Extensions I also copied gds32.dll from the php directory to the C:\windows\system32 directory. I restarted Apache. This is in my PHP script: $host = 10.1.4.58:c:\fbwin50\fbdata\fbdata.fdb; $username = SYSDBA; $password = masterkey; $dbh = ibase_pconnect ($host, $username, $password); $stmt = SELECT * FROM EVENTTYP; $sth = ibase_query ($dbh, $stmt); I get the following error: Warning: ibase_pconnect() [function.ibase-pconnect]: Unable to complete network request to host 10.1.4.58. Failed to locate host machine. Undefined service gds_db/tcp. in d:\htdocs\Website\PHP\dtest.php on line 17 Warning: ibase_query() [function.ibase-query]: invalid database handle (no active connection) in d:\htdocs\Website\PHP\dtest.php on line 20 I was able to use isql to remotely connect using the parameters above. What am I not doing on the PHP end to get this to work? -- -James
Re: [PHP] Image upload form
Okay, I started seeing some of my mistakes. I am still having a great deal of trouble: newfile returns: 0fdae2e9e6aa43f067a9dd780a5a36a6.jpg image_file returns: images/jpg/test/0fdae2e9e6aa43f067a9dd780a5a36a6.jpg images/jpg/test is set to 777 but I still get (Could not move file to destination). What am I missing? Thanks! ?php error_reporting(E_ALL); $uploaddir = images/jpg/test/; print_r($_FILES); $local_file = $_FILES['userfile']['tmp_name']; if (sizeof($local_file)) { //try to get image size; this returns false if this is not an actual image file. $image_test = getimagesize($local_file); if ($image_test !== false) { $mime_type = $_FILES['userfile']['type']; switch($mime_type) { case image/jpeg: $pext = 'jpg'; break; case image/tiff: $pext = 'tif'; break; default: echo The file you are trying to upload is an image, but it is not a tif or jpeg and therefore unacceptable.; } } else { echo The file you are trying to upload is not a valid image file; } $newfile = md5(date(l-F-j-Y i:s)).'.'.$pext; $image_file = $uploaddir . $newfile; // print_r($newfile); // print_r($image_file); if(!move_uploaded_file($newfile,$image_file)) { echo 'Could not move file to destination'; exit; } else { echo 'image file ?php echo $newfile ? uploaded.'; } } ? form enctype=multipart/form-data action=?php echo $_SERVER['PHP_SELF']; ? method=POST input type=hidden name=MAX_FILE_SIZE value=30 / !-- Name of input element determines name in $_FILES array -- Cartoon: input name=userfile type=file / input type=submit value=Upload File / /form -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] Image upload form
Hello Jack, Wednesday, June 15, 2005, 5:38:11 PM, you wrote: JJ newfile returns: 0fdae2e9e6aa43f067a9dd780a5a36a6.jpg JJ image_file returns: JJ images/jpg/test/0fdae2e9e6aa43f067a9dd780a5a36a6.jpg JJ images/jpg/test is set to 777 but I still get (Could not move file to JJ destination). What am I missing? Thanks! This directory needs to be absolute - i.e. the COMPLETE path: /usr/home/jack/images/jpg/test Or similar - whatever it needs to be on your server. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image upload form
Richard Davey wrote: Hello Jack, Wednesday, June 15, 2005, 5:38:11 PM, you wrote: JJ newfile returns: 0fdae2e9e6aa43f067a9dd780a5a36a6.jpg JJ image_file returns: JJ images/jpg/test/0fdae2e9e6aa43f067a9dd780a5a36a6.jpg JJ images/jpg/test is set to 777 but I still get (Could not move file to JJ destination). What am I missing? Thanks! This directory needs to be absolute - i.e. the COMPLETE path: /usr/home/jack/images/jpg/test Thanks, Richard, Still no soap: I changed $uploaddir = /home/jack/public_html/amyportnoy/images/jpg/test; and $image_file = $uploaddir . '/' . $newfile; Now $image_file returns the valid path of: /home/jack/public_html/amyportnoy/images/jpg/test/09992d5379dd0a0cf376aab82241a66d.jpg but it still does not copy the file to that location. However the error has changed: if (is_uploaded_file($newfile)) { if(!move_uploaded_file($newfile,$image_file)) { echo 'Could not move file to destination'; exit; } else { echo 'image file ?php echo $newfile ? uploaded.'; } } else { echo 'Problem with ' . $newfile; } } And I'm getting an error message of Problem with 6a26590fb45fd86e58954ba91d5580a4.jpg So i guess it's not uploading for some reason? Here's the whole thing I have so far once again, with several mods: ?php error_reporting(E_ALL); $uploaddir = /home/jack/public_html/amyportnoy/images/jpg/test; print_r($_FILES); if ($_FILES['userfile']['error'] 0) { echo 'Problem: '; switch ($_FILES['userfile']['error']) { case 1: echo 'File exceeds maximum upload size limit (upload_max_filesize).'; break; case 2: echo 'File exceeds maximum size limit (max_file_size).'; break; case 3: echo 'File was only partially uploaded.'; break; case 4: echo 'No file was uploaded.'; break; }//end switch }//end if error 0 $local_file = $_FILES['userfile']['tmp_name']; if (sizeof($local_file)) { //try to get image size; this returns false if this is not an actual image file. $image_test = getimagesize($local_file); if ($image_test !== false) { $mime_type = $_FILES['userfile']['type']; switch($mime_type) { case image/jpeg: $pext = 'jpg'; break; case image/tiff: $pext = 'tif'; break; default: echo The file you are trying to upload is an image, but it is not a tif or jpeg and therefore unacceptable.; } } else { echo The file you are trying to upload is not a valid image file; } $newfile = md5(date(l-F-j-Y i:s)).'.'.$pext; $image_file = $uploaddir . '/' . $newfile; // print_r($newfile); print_r($image_file); if (is_uploaded_file($newfile)) { if(!move_uploaded_file($newfile,$image_file)) { echo 'Could not move file to destination'; exit; } else { echo 'image file ' . $newfile . 'uploaded.'; } } else { echo 'Problem with ' . $newfile; } } ? form enctype=multipart/form-data action=?php echo $_SERVER['PHP_SELF']; ? method=POST input type=hidden name=MAX_FILE_SIZE value=30 / !-- Name of input element determines name in $_FILES array -- Cartoon: input name=userfile type=file / input type=submit value=Upload File / /form -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image upload form
On Thursday 16 June 2005 00:38, Jack Jackson wrote: //try to get image size; this returns false if this is not an actual image file. $image_test = getimagesize($local_file); if ($image_test !== false) { $mime_type = $_FILES['userfile']['type']; $_FILES['userfile']['type'] contains the mime-type that is provided by the browser and will vary depending on browser and hence extremely unreliable. In fact the returned value from getimagesize() already has mime-type info, use that instead. $newfile = md5(date(l-F-j-Y i:s)).'.'.$pext; $image_file = $uploaddir . $newfile; // print_r($newfile); // print_r($image_file); if(!move_uploaded_file($newfile,$image_file)) { echo 'Could not move file to destination'; exit; } The file pointed to by $newfile doesn't exist. You need to move ... $local_file = $_FILES['userfile']['tmp_name']; ... $localfile -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- New Year Resolution: Ignore top posted posts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php/osx and firebird
Undefined service gds_db/tcp. Sounds to me like it's not finding the port in services. I don't know what default port Firebird is listening on, but you should have an entry like gds_db/tcp 1234/tcp in c:\windows\system32\drivers\etc\services. You'll have to find out exactly which port it's listening on. I think you may need this on both the client and the server. kgt James wrote: I have a windows machine with Firebird and the default database. I've configured another machine with Apache and PHP. I want to write PHP scripts to remotely access the Firebird database. I followed the instructions at: http://us3.php.net/ibase I changed the php.ini to enable the php_interbase.dll and the php_gd2.dll by commenting out the two lines under Windows Extensions I also copied gds32.dll from the php directory to the C:\windows\system32 directory. I restarted Apache. This is in my PHP script: $host = 10.1.4.58:c:\fbwin50\fbdata\fbdata.fdb; $username = SYSDBA; $password = masterkey; $dbh = ibase_pconnect ($host, $username, $password); $stmt = SELECT * FROM EVENTTYP; $sth = ibase_query ($dbh, $stmt); I get the following error: Warning: ibase_pconnect() [function.ibase-pconnect]: Unable to complete network request to host 10.1.4.58. Failed to locate host machine. Undefined service gds_db/tcp. in d:\htdocs\Website\PHP\dtest.php on line 17 Warning: ibase_query() [function.ibase-query]: invalid database handle (no active connection) in d:\htdocs\Website\PHP\dtest.php on line 20 I was able to use isql to remotely connect using the parameters above. What am I not doing on the PHP end to get this to work? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache fails to start (oracle path problem?)
I ran into a similar problem trying to get ODBC working with a Progress database. I managed to solve it by setting the environment variables in the httpd startup script. Not much help, I know, but a suggestion. ;) good luck kgt Shane Presley wrote: Hello, I'm having trouble compiling and running PHP with oracle support. I was able to compile with the appropriate configure script, but only after I set my Oracle environment variables in my shell. That was no problem. The problem is, when Apache goes to load the php module, it fails, because it can't find the oracle library. Interactively I had to do this... export LD_LIBRARY_PATH=$ORACLE_HOME/lib But Apache.. Starting httpd: Syntax error on line 207 of /etc/httpd/conf/httpd.conf: Cannot load /usr/lib/httpd/modules/libphp4.so into server: libclntsh.so.10.1: cannot open shared object file: No such file or directory [FAILED] Not sure how I could set that for Apache? Shane -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Image upload form
Yes, Jason, Those did it! Thanks so much for the help! Jason Wong wrote: On Thursday 16 June 2005 00:38, Jack Jackson wrote: //try to get image size; this returns false if this is not an actual image file. $image_test = getimagesize($local_file); if ($image_test !== false) { $mime_type = $_FILES['userfile']['type']; $_FILES['userfile']['type'] contains the mime-type that is provided by the browser and will vary depending on browser and hence extremely unreliable. In fact the returned value from getimagesize() already has mime-type info, use that instead. $newfile = md5(date(l-F-j-Y i:s)).'.'.$pext; $image_file = $uploaddir . $newfile; // print_r($newfile); // print_r($image_file); if(!move_uploaded_file($newfile,$image_file)) { echo 'Could not move file to destination'; exit; } The file pointed to by $newfile doesn't exist. You need to move ... $local_file = $_FILES['userfile']['tmp_name']; ... $localfile -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sessions
Greetings from San Diego! I call session_start() on all my pages and then ? echo session_id(); ? and everything is the same from all the pages. However if I stuff a variable into $_SESSION it's never transferred between pages. So if I do a ? $_SESSION[Username] = Brian; ? and then go to another page and say ? echo $_SESSION[Username]; ? it comes back blank. It doesn't seem to matter if I enclose the Username in double quotes or single quotes ''' or nothing; I have no data. But like I said, the session id is being passed around just fine. Someone help??? Thanks, -brian Brian D. McGrew { [EMAIL PROTECTED] || [EMAIL PROTECTED] } --- YOU! Off my planet!
Re: [PHP] Sessions
On 6/15/05, Brian D. McGrew [EMAIL PROTECTED] wrote: Greetings from San Diego! Greetings from someplace-else. I call session_start() on all my pages and then ? echo session_id(); ? and everything is the same from all the pages. However if I stuff a variable into $_SESSION it's never transferred between pages. So if I do a ? $_SESSION[Username] = Brian; ? and then go to another page and say ? echo $_SESSION[Username]; ? it comes back blank. It doesn't seem to matter if I enclose the Username in double quotes or single quotes ''' or nothing; I have no data. But like I said, the session id is being passed around just fine. You have two options: 1) Pass the session name and id between pages. ?php session_start(); $_SESSION[ 'var' ] = 'blah'; $sn = session_name(); $sid = session_id(); echo EOF a href=nextpage.php?$sn=$sidLink/a EOF; ? 2) Use transparent sessions (cookie based). ini_set(session.use_trans_sid, 1); -- Greg Donald Zend Certified Engineer http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php/osx and firebird
Here's the answer! http://community.borland.com/article/0,1410,25290,00.html I updated the SERVICE file on my Apache/PHP machine and all is well. At 12:04 PM -0400 6/15/05, James wrote: I have a windows machine with Firebird and the default database. I've configured another machine with Apache and PHP. I want to write PHP scripts to remotely access the Firebird database. I followed the instructions at: http://us3.php.net/ibase I changed the php.ini to enable the php_interbase.dll and the php_gd2.dll by commenting out the two lines under Windows Extensions I also copied gds32.dll from the php directory to the C:\windows\system32 directory. I restarted Apache. This is in my PHP script: $host = 10.1.4.58:c:\fbwin50\fbdata\fbdata.fdb; $username = SYSDBA; $password = masterkey; $dbh = ibase_pconnect ($host, $username, $password); $stmt = SELECT * FROM EVENTTYP; $sth = ibase_query ($dbh, $stmt); I get the following error: Warning: ibase_pconnect() [function.ibase-pconnect]: Unable to complete network request to host 10.1.4.58. Failed to locate host machine. Undefined service gds_db/tcp. in d:\htdocs\Website\PHP\dtest.php on line 17 Warning: ibase_query() [function.ibase-query]: invalid database handle (no active connection) in d:\htdocs\Website\PHP\dtest.php on line 20 I was able to use isql to remotely connect using the parameters above. What am I not doing on the PHP end to get this to work? -- -James -- -James
[PHP] Reading binary file data into variable
I am following Coggeshall's article on Zend for creating ZIP files. I seem to have run into a problem with PDF's though. In his code you have to read the file into a variable. I have tried file_get_contents, readfile, a combination of fopen, fpassthru, etc $filedata = readfile(INVOICEDIR.AOM.1075.542.54243641075B05130.pdf); The next line in this little jewel runs the data through the ZIP routines, $zipfile-add_file($filedata, tempzip/AOM.1075.542.54243641075B05130.pdf); I stayed up too late last night and got up too early this morning, so I am just brain-farting on what I should do here. How do I get (or can I get) the PDF data into the variable so that it comes out smelling like a rose on the other end of the train where the ZIP file get opened and the individual files are exapndable? BTW, I have tested this with text too. I am having some problems there as well, because file_get_contents seems to leave things 'short'. However, if I fopen the text file and read the text into a variable I can do the output side. I appreciate any and all insight into this problem, even Nichel's :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reading binary file data into variable
Jay Blanchard wrote: I am following Coggeshall's article on Zend for creating ZIP files. I seem to have run into a problem with PDF's though. In his code you have to read the file into a variable. I have tried file_get_contents, readfile, a combination of fopen, fpassthru, etc $filedata = readfile(INVOICEDIR.AOM.1075.542.54243641075B05130.pdf); The next line in this little jewel runs the data through the ZIP routines, $zipfile-add_file($filedata, tempzip/AOM.1075.542.54243641075B05130.pdf); I stayed up too late last night and got up too early this morning, so I am just brain-farting on what I should do here. How do I get (or can I get) the PDF data into the variable so that it comes out smelling like a rose on the other end of the train where the ZIP file get opened and the individual files are exapndable? BTW, I have tested this with text too. I am having some problems there as well, because file_get_contents seems to leave things 'short'. However, if I fopen the text file and read the text into a variable I can do the output side. I appreciate any and all insight into this problem, even Nichel's :) Did you try using fopen's binary safe read? Something like : $binary_data = ; $fp = fopen ( $file, rb ); while ( ! feof ( $fp ) ) { $binary_data .= fgets ( $fp ); } fclose ( $fp ); Don't know if it will work (or if you already tried it)...more like a guess. PS don't trust that Nichel guy, he's really a HTML monkey using Front Page. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Feedback on the various PHP-MVC implementations
Hi, folks. I'm looking for some feedback on a couple of the php mvc implementations out there. The two that I've seen referenced the most are php.MVC (http://www.phpmvc.net) and Phrame (http://phrame.sourceforge.net). I've looked around and found some okay opinions on both, but I'd really like to hear from some people on this list who have used one or both directly, or any other MVC frameworks that you feel are worth mentioning. I've looked through the archives but have not found much from people who have actually implemented any of these frameworks, just mainly comments of what they look like on the surface. If anyone here has any direct experience with either of the above frameworks, or with any other stable, mature frameworks please let me know. Cheers and TIA, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Reading binary file data into variable
[snip] Did you try using fopen's binary safe read? Something like : $binary_data = ; $fp = fopen ( $file, rb ); while ( ! feof ( $fp ) ) { $binary_data .= fgets ( $fp ); } fclose ( $fp ); Don't know if it will work (or if you already tried it)...more like a guess. [/snip] Yes, tried that. It throws an error when trying to open the ZIP file missing 1 byte in Zip File... [snip] PS don't trust that Nichel guy, he's really a HTML monkey using Front Page. [/snip] But I think I can make him buy us all a beer one day. BTW, even though this is Texas I found some Dixie the other daymm delicious Dixie Beer. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] incrementing a register global
I dont know it this is possible, but here it goes. Hopefully I cac explain it well enough for someone to understand. I am posting data to a php script. I have several variables that are the same except the number at the end is different. So the url of the called script will be something like: http://www.something.com/test.php?name1=Samname2=Billname3=Joe On my script I am using substr() and strrchr() to get the number of last variable: $names = substr(strrchr($_SERVER['QUERY_STRING'],),7,1); I am then trying to run a loop to call each variable and just print it on the screen: for($i=1;$i=$boxes;$i++){ echo $_GET['name'].$i; } This is where my problem is. And I dont know if this is even possible, but if you look at the echo line in the loop I am trying to add the number of $i to the register global. I dont get an error in doing this, but when I run the script I get the number of $i instead of the value of $_GET['name1'] Like I said, I hope I explained this good enough for someone to know what I am trying to do. If anyone has any suggestions or comments about doing something like this please let me know. Thanks, Aaron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP module permissions
After upgrading my fedora core 3 box with the latest selinux update i get the following error when trying to start apache (2.0.54-prefork) Cannot load /usr/local/apache2/modules/libphp4.so into server: /usr/local/apache2/modules/libphp4.so: cannot restore segment prot after reloc: Permission denied Im using PHP-4.3.11, when I turn off selinux it works, nobody has any suggestion over at fedoraforum so anyone here got any ideas what to change or a quick fix ? TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] incrementing a register global
[snip] I dont know it this is possible, but here it goes. Hopefully I cac explain it well enough for someone to understand. I am posting data to a php script. I have several variables that are the same except the number at the end is different. So the url of the called script will be something like: http://www.something.com/test.php?name1=Samname2=Billname3=Joe On my script I am using substr() and strrchr() to get the number of last variable: $names = substr(strrchr($_SERVER['QUERY_STRING'],),7,1); I am then trying to run a loop to call each variable and just print it on the screen: for($i=1;$i=$boxes;$i++){ echo $_GET['name'].$i; } This is where my problem is. And I dont know if this is even possible, but if you look at the echo line in the loop I am trying to add the number of $i to the register global. I dont get an error in doing this, but when I run the script I get the number of $i instead of the value of $_GET['name1'] Like I said, I hope I explained this good enough for someone to know what I am trying to do. If anyone has any suggestions or comments about doing something like this please let me know. [/snip] Your terminology is a little mixed-up, you are not dealing with a 'register global' you are dealing with a variable and an array. If you will do this... print_r($_GET); You will see am array. then you can do something like this..(without the substring manipulation above) for($i = 0; $i count($_GET); $i++){ echo $_GET[$i] . \n; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Reading binary file data into variable
[snip] Did you try using fopen's binary safe read? Something like : [/snip] Shy of being able to do this in the way that I imagined, does anyone know of a class (not requiring PHP 5, as one does on phpclasses.org) that will allow me to specify several PDF and/or other files in a directory to be zipped up so that the archive can be unzipped by the great unwashed at some point? TVMIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Anyone ever upgraded PHP at GoDaddy?
GoDaddy's Virtual Dedicated Servers come with PHP 4.2 - anyone ever upgraded this to 4.3 or later? I've never done any command line stuff or anything like that - is there an easier way? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checkboxes From Intersection Redux
That did it exactly, Kristen Thanks so much for the help! (and sorry for sending this to you and not the list the first time!) JJ Kristen G. Thorson wrote: Hopefully I understand your question correctly. You have this SQL: $media_query = 'SELECT media_id,media_name FROM media GROUP BY media_name'; And For every media_id which is associated with $cartoon in the table media_art, check the box; for all others leave them unchecked. The problem is, the SQL you have is not returning every media_id (because you're grouping on media_name). I wonder if you truly need to group on media_name. I would assume that media_name is unique in the media table. If it is not, then you need to rethink your table structure. If you group on media_name and there are duplicate media_names, you can have data like this: media_id media_name 4Name1 16 Name1 Grouping by media_name as in your query above will produce a line like: media_idmedia_name 4 Name1 You then output this to check boxes and use those to set the relation to art and media. But what's the difference between media_id 4 and media_id 16? In this case, if the database always returns the group by this way, you would never set the media_id 16. If there is a distinct difference between media_names with different ids, then I think you probably need to make some changes. That being said, if you do not need to group by media_name, then you can simply do something like this: select media.media_id, media.media_name, media_art.art_id, from media left join media_art on media_art.media_id=media.media_id and media_art.art_id=$cartoon['art_id'] Which would return a table like this if $cartoon['art_id']=15: media_idmedia_name art_id 4 Name1 NULL 8 Name2 15 12 Name3 NULL 16 Name4 15 17 Name5 NULL 18 Name6 NULL You could then test the output of art_id: $checkbox_media[] = input type='checkbox' name='media_types[]' value='{$media_rows['media_id']}' .(rows['art_id']==$cartoon['art_id']? checked:)./{$media_rows['media_name']} ; HTH kgt Jack Jackson wrote: Hi, With your help I got some checkboxes generated the other day for a form. I would like some help getting a similar problem solved. I am now making a form to edit db entries made in the previous form. I have three tables involved: art, media and media_art. I need to show checkboxes for all available media. For the chosen record ($cartoon, which equals an art_id selected by the user) I must also go into the media_art table, and where the selected art ID has a corresponding media_id, display that media_id's media_name as a checked box. TABLE media: media_id media_name 1 ink 2 pencil 3 watercolor 4 gauche 5 watercolor pencil To find out the art_id of the chosen record, the user is selecting from a dropdown box in the form. I'm doing queries like this to make a publisher dropdown in a similar vein: $query = SELECT * FROM art WHERE art.art_id = '$cartoon'; $publisher_query = 'SELECT * FROM publisher'; $result = mysql_query($query); $publisher_result = mysql_query($publisher_query); while ($rows = mysql_fetch_assoc($result)){ $publisher_dropdown = 'select name=publisher_id'; while ($pub = mysql_fetch_assoc($publisher_result)){ $publisher_dropdown .= 'option value=' . $pub['publisher_id']; if ($pub['publisher_id'] == $rows['publisher_id']){ $publisher_dropdown .= ' selected '; } $publisher_dropdown .= '' . htmlentities($pub['publisher_name']); } $publisher_dropdown .= '/select'; } I now need to formulate how to make the checkboxes similarly. The original setup to make the checkboxes was : $media_query = 'SELECT media_id,media_name FROM media GROUP BY media_name'; $media_result = mysql_query($media_query); $checkbox_media = array (); $media_types = array(); while ($media_rows = mysql_fetch_assoc($media_result)){ $checkbox_media[] = input type='checkbox' name='media_types[]' value='{$media_rows['media_id']}' /{$media_rows['media_name']} ; } Those which were checked were inserted into media_art thusly: media_id art_id 31 41 51 What I want to do is say For every media_id which is associated with $cartoon in the table media_art, check the box; for all others leave them unchecked. How can I do this? Thanks very much in advance, Jack -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anyone ever upgraded PHP at GoDaddy?
On 6/15/05, Brian Dunning [EMAIL PROTECTED] wrote: GoDaddy's Virtual Dedicated Servers come with PHP 4.2 - anyone ever upgraded this to 4.3 or later? I've never done any command line stuff or anything like that - is there an easier way? Make yourself a phpinfo() page. Your PHP configuration will be at the top of the page. You can use that configure line to build/upgrade to a newer PHP. -- Greg Donald Zend Certified Engineer http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anyone ever upgraded PHP at GoDaddy?
On Jun 15, 2005, at 2:28 PM, Greg Donald wrote: Make yourself a phpinfo() page. Your PHP configuration will be at the top of the page. You can use that configure line to build/upgrade to a newer PHP. I see that, thanks - but if you'll forgive an ignorant question, what do I do with that configure line? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache fails to start (oracle path problem?)
Thank you! That fixed it. I just had to define the Oracle env variables on the httpd startup script. So that was a huge help :) Shane On 6/15/05, Kristen G. Thorson [EMAIL PROTECTED] wrote: I ran into a similar problem trying to get ODBC working with a Progress database. I managed to solve it by setting the environment variables in the httpd startup script. Not much help, I know, but a suggestion. ;) good luck kgt Shane Presley wrote: Hello, I'm having trouble compiling and running PHP with oracle support. I was able to compile with the appropriate configure script, but only after I set my Oracle environment variables in my shell. That was no problem. The problem is, when Apache goes to load the php module, it fails, because it can't find the oracle library. Interactively I had to do this... export LD_LIBRARY_PATH=$ORACLE_HOME/lib But Apache.. Starting httpd: Syntax error on line 207 of /etc/httpd/conf/httpd.conf: Cannot load /usr/lib/httpd/modules/libphp4.so into server: libclntsh.so.10.1: cannot open shared object file: No such file or directory [FAILED] Not sure how I could set that for Apache? Shane -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] COM integration problems
Hi all, I'm trying to interface with verisign's payflow pro on windows using the COM workaround. This code was originally taken from an example listed with the manual as a workaound for the fact that the php pfpro functions are not supported on windows. It worked for some time until the server was upgraded to windows 2003 server. Now, all calls to instantiate a COM object return the boolean value 'true' $pfpro_client = new COM('PFProCOMControl.PFProCOMControl.1'); // this line outputs 'true' echo $pfpro_client; //Connect to Verisign via COM object... // this line gives a call to a member function on a non object error $pfpro_context = $pfpro_client-CreateContext($this-getURL(), 443, 24,,0,,); I've tried other COM objects like new COM(InternetExplorer.Application) and it also returns 'true'. Other tests of the pfpro install are sucessful (asp, pfpro.exe), so i believe the payflow config is correct. It just seems like the php com integration is screwed up. Any ideas? thanks, jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anyone ever upgraded PHP at GoDaddy?
Hi, you need to get the appropriate php tarball from http://www.php.net/downloads.php and check out this page: http://www.geocities.com/tipsforlinux/articles/27.html It will tell you how to: - extract the sources - run configure (this is where you use the configure line from phpinfo) - install compiled binaries Laurent 2005/6/15, Brian Dunning [EMAIL PROTECTED]: On Jun 15, 2005, at 2:28 PM, Greg Donald wrote: Make yourself a phpinfo() page. Your PHP configuration will be at the top of the page. You can use that configure line to build/upgrade to a newer PHP. I see that, thanks - but if you'll forgive an ignorant question, what do I do with that configure line? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anyone ever upgraded PHP at GoDaddy?
On 6/15/05, Brian Dunning [EMAIL PROTECTED] wrote: On Jun 15, 2005, at 2:28 PM, Greg Donald wrote: Make yourself a phpinfo() page. Your PHP configuration will be at the top of the page. You can use that configure line to build/upgrade to a newer PHP. I see that, thanks - but if you'll forgive an ignorant question, what do I do with that configure line? You use it to configure your PHP for compilation. See http://www.php.net/manual/en/install.php -- Greg Donald Zend Certified Engineer http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP] Re: Converting [and] to XML format- help/advise requested
On 6/15/05, Tom Rogers [EMAIL PROTECTED] wrote: Hi, Wednesday, June 15, 2005, 4:42:24 AM, you wrote: DC On 6/14/05, Sebastian Mendel [EMAIL PROTECTED] wrote: Dotan Cohen wrote: Hi gurus. I'm having fun replacing the text within [ and ] to XML format on 4000+ files on a windows XP machine. I installed php (and an apache server) on the machine because it is the only language the I am remotely familiar with. I want and text that is with [ and ] to be enclosed with note and /note. Going through the archives I found this nice regex (I changed it a bit- I hope that I didn't break anything important) that fits into str_replace: str_replace(/[([a-zA-Z]+?)]/, note.$what was_inside_the_parethesis./note, $string); str_replace doesnt support regular expressions http://www.php.net/str_replace what you need is preg_replace() http://www.php.net/preg_replace But how on sweet mother Earth do I get the $what was_inside_the_parethesis variable to stick into the note tags? I tried functions that would remove the [ and ], then do $new_str=note.$what was_inside_the_parethesis./note; and then replace the whole [$what was_inside_the_parethesis] with $new_str. I did get that far. preg_replace( '/\[([^\]]+)\]/', 'note\1/note', $string); Now the catch! If $what_was_inside_the_parethesis contains the word 'algebra' then I want nothing returned- in other words [$what was_inside_the_parethesis] should be cut out and nothing put in it's place. I added an if function in there that checked the presence of the word algebra, but it ALWAYS returned blank. preg_replace( '/\[(algebra|([^\]]+))\]/', 'note\2/note', $string); just to mention, you need only the second example, the first ist just to explain the step toward the final ocde. Sebastian Mendel www.sebastianmendel.de www.sf.net/projects/phpdatetime | www.sf.net/projects/phptimesheet DC Thank you very much Sebatian! I can't believe that you got that out of DC one line of code! I often feel that i have a lot to learn, but now I DC see that I also have a lot to improve... DC The code works great for [] tags that do not contain the word algebra. DC If the word algebra is alone between the tags then it returns DC note/note, which I can easily remove with one more line of code. DC But if the word algebra appears with another word, then it is DC converted to a note just as if it did not contain the word. DC I tried adding asterisks and plus-signs at stratigec places within the DC regex, but I am not succeeding in getting them to do what I want. I DC suppose that I would be overstaying my welcome if I asked just where DC to put them? DC Dotan DC http://lyricslist.com/lyrics/artist_albums/402/pink_floyd.php DC Pink Floyd Lyrics DC -- DC PHP General Mailing List (http://www.php.net/) DC To unsubscribe, visit: http://www.php.net/unsub.php You can use preg_replace_callback to give you a bit more control, so using Sebastions first expression you could do function check_string($matches){ if(preg_match('/algebra/i',$matches[0])) return ''; return 'note'.$matches[0].'/note'; } preg_replaec_callback('/\[([^\]]+)\]/','check_string',$string); -- regards, Tom Thanks, I did not know about the preg_replace_callback function. I'll start playing with that now. Something new every day! Dotan http://lyricslist.com/lyrics/artist_albums/108/carey_mariah.php Mariah Carey Lyrics -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Converting [and] to XML format- help/advise requested
On 6/15/05, Sebastian Mendel [EMAIL PROTECTED] wrote: Dotan Cohen wrote: Hi gurus. I'm having fun replacing the text within [ and ] to XML format on 4000+ files on a windows XP machine. I installed php (and an apache server) on the machine because it is the only language the I am remotely familiar with. I want and text that is with [ and ] to be enclosed with note and /note. Going through the archives I found this nice regex (I changed it a bit- I hope that I didn't break anything important) that fits into str_replace: str_replace(/[([a-zA-Z]+?)]/, note.$what was_inside_the_parethesis./note, $string); str_replace doesnt support regular expressions http://www.php.net/str_replace what you need is preg_replace() http://www.php.net/preg_replace But how on sweet mother Earth do I get the $what was_inside_the_parethesis variable to stick into the note tags? I tried functions that would remove the [ and ], then do $new_str=note.$what was_inside_the_parethesis./note; and then replace the whole [$what was_inside_the_parethesis] with $new_str. I did get that far. preg_replace( '/\[([^\]]+)\]/', 'note\1/note', $string); Now the catch! If $what_was_inside_the_parethesis contains the word 'algebra' then I want nothing returned- in other words [$what was_inside_the_parethesis] should be cut out and nothing put in it's place. I added an if function in there that checked the presence of the word algebra, but it ALWAYS returned blank. preg_replace( '/\[(algebra|([^\]]+))\]/', 'note\2/note', $string); just to mention, you need only the second example, the first ist just to explain the step toward the final ocde. The code works great for [] tags that do not contain the word algebra. If the word algebra is alone between the tags then it returns note/note, which I can easily remove with one more line of code. But if the word algebra appears with another word, then it is converted to a note just as if it did not contain the word. $search = array( '/\[[^\]*algebra[^\]*\]/', '/\[([^\]]+)\]/', ); $replace = array( '', 'note\1/note', ); preg_replace( $search, $replace, $string); -- Sebastian Mendel www.sebastianmendel.de www.sf.net/projects/phpdatetime | www.sf.net/projects/phptimesheet Thank you Sebastian. Know that I not only appreciate your assistance, but that I also make a genuine effort to learn from your example. I think that it's about time that I learned to brew regexes. On my to google now... Dotan http://lyricslist.com/lyrics/artist_albums/321/madonna.php Madonna Lyrics -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ftruncate() and stream wrappers
I dont see support for using ftruncate() on user defined stream wrappers. When I try to truncate one I get an E_WARNING: Warning: ftruncate() [function.ftruncate]: Can't truncate this stream! Does anyone know of a way to truncate a user defined stream wrapper using php's file system or stream functions? -justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] passthru() passing variables
Hi, I have been told that in order to pass variables via passthru() to another script (in my case, a perl script) one can do the following ... passthru(home/test.cgi $var) and that $var will then be passed through to the cgi. I have tried this and failed. Is this the proper format or is there something that I am missing. Thanks, chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] incrementing a register global
On Wed, June 15, 2005 12:43 pm, Aaron Todd said: I dont know it this is possible, but here it goes. Hopefully I cac explain it well enough for someone to understand. I am posting data to a php script. I have several variables that are the same except the number at the end is different. So the url of the called script will be something like: http://www.something.com/test.php?name1=Samname2=Billname3=Joe On my script I am using substr() and strrchr() to get the number of last variable: $names = substr(strrchr($_SERVER['QUERY_STRING'],),7,1); I am then trying to run a loop to call each variable and just print it on the screen: for($i=1;$i=$boxes;$i++){ echo $_GET['name'].$i; } This is where my problem is. And I dont know if this is even possible, but if you look at the echo line in the loop I am trying to add the number of $i to the register global. I dont get an error in doing this, but when I run the script I get the number of $i instead of the value of $_GET['name1'] Like I said, I hope I explained this good enough for someone to know what I am trying to do. If anyone has any suggestions or comments about doing something like this please let me know. You could use variable variables, but what you REALLY should do is change your $foo1 $foo2 $foo3 into an array of $foo[1] $foo[2] $foo[3] It will be MUCH easier! -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions
On Wed, June 15, 2005 10:38 am, Brian D. McGrew said: I call session_start() on all my pages and then ? echo session_id(); ? and everything is the same from all the pages. However if I stuff a variable into $_SESSION it's never transferred between pages. So if I do a ? $_SESSION[Username] = Brian; ? and then go to another page and say ? echo $_SESSION[Username]; ? it comes back blank. It doesn't seem to matter if I enclose the Username in double quotes or single quotes ''' or nothing; I have no data. But like I said, the session id is being passed around just fine. Check your php.ini settings to be sure the ECGPS settings haven't revoked $_SESSION getting populated... It's pretty odd for somebody to do that, but it would fit the symptoms -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How to print variable name and contents
I want to write a trace procedure and call it with variable names, and I am having trouble with the syntax. My goal is to have a procedure that will echo lines such as: Trace: $myvar=the contents of $myvar My attempt that didn't work is to write a function: function my_trace($m){ echo (\nbrTRACE: $m = ); eval(\$t=\$m\;); echo($t.br\n); } and call it with statements like: my_trace(\$my_var); my_trace(\$_ENV[\COMPUTERNAME\]); What am I doing wrong, and how should this be done? Also, should I post to a different group? Thanks, Gil Grodsky [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to print variable name and contents
Hello, Wednesday, June 15, 2005, 2:33:48 PM, you wrote: ncn I want to write a trace procedure and call it with variable ncn names, and I am having trouble with the syntax. My goal is to ncn have a procedure that will echo lines such as: ncn Trace: $myvar=the contents of $myvar ncn My attempt that didn't work is to write a function: ncn function my_trace($m){ ncnecho (\nbrTRACE: $m = ); ncneval(\$t=\$m\;); ncnecho($t.br\n); ncn } Here's one way: function my_trace ($varname, $varvalue) { $varvalue = print_r($varvalue, true); echo TRACE: $varname = \$varvalue\br /; } my_trace(\$my_var, $my_var); Another might be to look at the var_dump and var_export functions. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Retrievable weather service info?
http://weather.noaa.gov/pub/data/observations/metar/stations/SABE.TXT Here you get the METAR report in plaintext format..now is your work to decode it.HAVE FUN !! I already made something to read thouse text files...If you want I can share it. cheers! pancarne. On 6/15/05, Clive Zagno [EMAIL PROTECTED] wrote: Hi Murray Ive managed to get the local weather in cape town or for any airport that has a ITIA code. the webservice is provide by: http://www.capescience.com/webservices/globalweather/index.shtml you will need to get nusoap from sourceforge to make use of the webservice. regards clive -- PHP General Mailing List ( http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passthru() passing variables
On Wed, June 15, 2005 5:36 pm, Chris Herold said: I have been told that in order to pass variables via passthru() to another script (in my case, a perl script) one can do the following ... passthru(home/test.cgi $var) and that $var will then be passed through to the cgi. I have tried this and failed. Is this the proper format or is there something that I am missing. You may want to use exec first, so you can more easily capture the error output and error codes. exec(home/test.cgi $var, $output, $error); if ($error){ //You should probably use error_log here in your real code... //ASSUME this is going to break some day, for whatever reason. //You'll need it logged unless you like dealing with error reports like: //Hey, the website broke yesterday. echo OS Error: $errorbr /\n; echo implode(br /, $output); exit; } echo $output; Meanwhile, odds are *REALLY* good that you're not even calling the test.cgi script because you haven't provide a path that PHP can use. home/test.cgi would be assuming that home was in the same directory as your PHP script, and even that is kinda iffy depending on where you do this from the webserver or CLI... I would recommend using FULL PATH to *everything* in exec (and passthru) /full/path/to/home/test.cgi /full/path/to/any/args.txt Also be sure to use the escapeshellargs function to make your $var data kosher if it comes from the outside world. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php/osx and firebird
On Wed, June 15, 2005 9:04 am, James said: $host = 10.1.4.58:c:\fbwin50\fbdata\fbdata.fdb; $username = SYSDBA; $password = masterkey; $dbh = ibase_pconnect ($host, $username, $password); $stmt = SELECT * FROM EVENTTYP; $sth = ibase_query ($dbh, $stmt); Warning: ibase_pconnect() [function.ibase-pconnect]: Unable to complete network request to host 10.1.4.58. Failed to locate host machine. Undefined service gds_db/tcp. in d:\htdocs\Website\PHP\dtest.php on line 17 I don't know diddly-squat about this Firebird ibase stuff, but this sounds to me like a network error message that your PHP machine can't get to the Firebird machine. Start at the lowest level. Can you ping 10.1.4.58 from your PHP box? It might be configured/firewalled to not let you do ping so it's not REQUIRED that ping work for your PHP script to work, but it's at least a start. Warning: ibase_query() [function.ibase-query]: invalid database handle (no active connection) in d:\htdocs\Website\PHP\dtest.php on line 20 Ignore this for now -- It's a direct result of the first error. I was able to use isql to remotely connect using the parameters above. Wow. Okay, that's way better than my ping test above... Still, double check that this still works, just to be SURE. What am I not doing on the PHP end to get this to work? PHP runs as the user defined by User directive in httpd.conf Odds are really good your isql remote test was run by you logged in as, errr, whatever Windows logs you in as, or whatever you log in as, if you're on a Windows box that has logins, or... Well, anyway, it almost for sure is not the same User as you have set in httpd.conf In the ideal world, you'd know how to log into your Windows box as the PHP User -- If you *DO* log in to your Windows box, then do this. If not, JUST FOR TESTING, you could change the User setting in httpd.conf to be, like, Administrator or whatever the Windoze root user is called this week. Restart Apache, and test. If that works, you have narrowed it down to a permissions problem. God only knows how you fix that under Windows, but it's the most likely source of your problem. The thing you *DO* *NOT* want to do, no matter what, is leave Apache running as Administrator! Change it back immediately after your test. If you have to choose between running PHP as Admin, and getting fired because you can't make this work, start looking for a new job. It's that important. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Compiling problem (apxs)
On Wed, June 15, 2005 6:39 am, Shane Presley said: I have a RedHat system running Apache and PHP Version 4.3.2. These were pre-installed Red Hat packages. Things worked nicely. What you are missing is the RPM apache-devel or httpd-devel or somethinghereaboutapache-devel The *-devel RPMs essentially contain all the source code you WOULD have if you had compiled from source, so PHP can find it. If that doesn't work (and I can't guarantee it will) then you may want to goahead and compile Apache from source, because that's easier than futzing with the source RPMs to custom configure them, imho. There also *MIGHT* be a php-oracle RPM out there... It may not be on RedHat's server, and you should definitely do some due diligence before installing RPMs from randomly-selected (Googled) web-sites, but it might be easier to stay up-to-date in your current process than remembering to check PHP versions, downoad, install etc. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] OT Major Release Versions
This is Computer Software philosophical musing, not specifically related to just PHP, but applicable to PHP and, well, all other OpenSource software... As I sit here surrounded by machines (physically and virtually) and realizing that while I've got most of them on auto-update as much as I can, or I've foisted off the updating on somebody else (for $$$) because I just don't *WANT* to be a SysAdmin... I'm still left with a lot of hours I'd have to invest to really be as current as I'd like to be. Let's take RedHat and other OSes, for example, only because I don't want this to devolve into the what version of PHP should I use thread that would be a hot button here. [Not that RedHat and or its versions aren't almost as hot, but...] I've got RedHat 8, RedHat 9, FC2, and FC3 on different machines here and at client's sites. Oh, and Win XP Home, just for fun, for testing stupid IE bugs. I'd love to just move them all to FC3 (4 now?) but it would really be painful, and a lot more hours than I have available. Now, the thing is, it's finally gotten to the point where I'm willing to let the OS authors/maintainers (RedHat) update my box for me, because, with the current arms race in viruses and whatnot, that's got to be better than my inability to stay on top of things, even if occasionally it breaks something that actually worked before. My philosophical question is: Why can't the damn things just have an easy one-click button to go from major version to major version, or if I'm willing to turn over control of the OS versioning to RedHat (or whomever) just do it automatically? Okay, I can accept that for Microsoft and other proprietary software, that's a non-option, because they WANT to force you to BUY the new version, though with their new subscription model... Well, let's not get into THAT argument either. Forget the Windows box. In the past, I've been told that the various pieces of software version control and tracking means that you need the clean break of a major release to keep sanity in versions. I think that was true then, but is it really true now? I mean, with all these fancy RPM/apt-get/cvs/svn thingies floating around, and all the version control already inherent to those processes, and the sheer amount of data being tracked by that... Would it really break the bank to just have the OS go from major release to major release without my spending days of my time shlepping data around and dinking around with re-boots and CDRs and hard drives and whatnot? I know a lot of you guys actually ENJOY that kind of stuff, and playing with the new distro is your idea of a Good Time. But is that what Joe Sixpack and Betsy Buick really want? Are we really presenting the average user with the BEST software when they can only use it a year or two before they have to spend a day fraught with stress and wondering if their hardware and data will survive, just so they can be something like remotely current? How does that bode for our long-term prospects in today's arms race with viruses and trojans and other Bad Guys? We *KNOW* too many average users simply aren't going to upgrade, because of that pain. We *KNOW* that telling them they need to be current doesn't cut it. Hell, even *WE* can't stay current on every box. I know I'm not alone here. Why don't we actually solve this one, for those who are willing to let the OS upgrade itself, with the technological leap of just keeping it CURRENT even if it's from 4.4.13 to 5.0? Am I just being crotchety here, or what? :-) -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: unable to load php_gd2.dll
Try extension_dir = ./extensions Nadim Attari Alienworkers.com Okay I at loss. I have tried but i can seem to get the php_gd2.dll to work properly. Any help this is what i have done so far. I have in my php.ini file, ; Directory in which the loadable extensions (modules) reside. extension_dir = C:\PHP\extensions I have also uncommented the extension = php_gd2.dll I have in the c:\php\extension folder the php_gd2.dll I have restarted IIS but still nothing I am using Window XP $ 2000 with IIS 5.0 but still nothing Please help Disieyi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image upload form
http://www.php-help.net/sources-php/image.upload.function.353.html Regards, Nadim Attari Alienworkers.com Hi, After a disastrous first attempt (which uploaded images but only by chance) it was suggested I rework the entire thing. This one seems to check the file against getimagesize and if that doesn't prove false, check the type and make the extension then rename the file. But the moving part is not working, and it does not kick back any error, it just fails. Can anyone tell me what I am doing wrong, and also if this is sufficient to a) upload images safely and b) protect against tampering? Thanks in advance, JJ ?php error_reporting(E_ALL); $uploaddir = images/jpg/test/; // print_r($_FILES); $local_file = $_FILES['userfile']['tmp_name']; if (sizeof($local_file)) { //try to get image size; this returns false if this is not an actual image file. $image_test = getimagesize($local_file); if ($image_test !== false) { $mime_type = $_FILES['userfile']['type']; switch($mime_type) { case image/jpeg: $pext = 'jpg'; break; case image/tiff: $pext = 'tif'; break; default: echo The file you are trying to upload is an image, but it is not a tif or jpeg and therefore unacceptable.; } } else { echo The file you are trying to upload is not a valid image file; } $main_image = md5(date(l-F-j-Y i:s)).'.'.$pext; move_uploaded_file($main_image,$uploaddir); } ? form enctype=multipart/form-data action=?php echo $_SERVER['PHP_SELF']; ? method=POST input type=hidden name=MAX_FILE_SIZE value=30 / !-- Name of input element determines name in $_FILES array -- Cartoon: input name=userfile type=file / input type=submit value=Upload File / /form -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php