[PHP] How to install php5 on Fedora Core2
I have some difficulties when installing php5.0.2 on FC2 I used the default settings: ./configure --with-apxs2=/usr/sbin/apxs build build install The installation is complete but when I test phpinfo() in a .php file from browser, the browser says "Can't find the server" My FC2 is fully installed and I don't know why the php module doesn't work. I doubt if there is some manual settings are need during the configuration/make/make install, or there is some setting after the installation such as change the default httpd.conf or /etc/php.ini I type php -v, the version is fine, php -i is also correct. But I can't make it work through http. Thanks in advance for any kindly help! eruisi 10/03/2004 04:00:59 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Retrieving large results from a database ends in memory error.
Hi Guys I am trying to retrieve over 5000 rows from a mysql database, i have to use a "SELECT *" query as i am required to use all the fields for display. Everytime i try to run the code below i get a Allowed memory size of 10485760 bytes exhausted (tried to allocate 40 bytes). Now if i change php's memory limit in the php.ini file to something like 80MB then its fine, but i can't be guarantied that the person who this code is for will be able or willing to access their php.ini file. Basically what i am asking is there a better way to write this query so i can still retrieve all the results from the database without running into memory issues ? should i break it up into chunks and put it through a loop ? Any assitance on retriving large amout of info from a db would be most appreciated. THis is the basic code i am using: $q = "SELECT * FROM `users` ORDER BY UserID"; $r = mysql_query($q) or die("There has been a query error: ".mysql_error()); if($getR = mysql_fetch_array($r,MYSQL_ASSOC)){ do { $userarray[] = $getR; } while($getR = mysql_fetch_array($r)); echo 'Done retrieved '.count($getR).' records.'; } else { echo 'there has been an error retrieving the results.'; } Thanks Jarratt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Including function libraries
Jasper Howard wrote: it seems possible that this is the problem, you called it, "checkLoggedIn()" in your script then tried to call, "checkloggedin()". Notice the caps aren't there when you tried to call it. Case does not matter for functions. Only for variable names. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Retrieving large results from a database ends in memory error.
Use mysql_unbuffered_query() RaTT wrote: Hi Guys I am trying to retrieve over 5000 rows from a mysql database, i have to use a "SELECT *" query as i am required to use all the fields for display. Everytime i try to run the code below i get a Allowed memory size of 10485760 bytes exhausted (tried to allocate 40 bytes). Now if i change php's memory limit in the php.ini file to something like 80MB then its fine, but i can't be guarantied that the person who this code is for will be able or willing to access their php.ini file. Basically what i am asking is there a better way to write this query so i can still retrieve all the results from the database without running into memory issues ? should i break it up into chunks and put it through a loop ? Any assitance on retriving large amout of info from a db would be most appreciated. THis is the basic code i am using: $q = "SELECT * FROM `users` ORDER BY UserID"; $r = mysql_query($q) or die("There has been a query error: ".mysql_error()); if($getR = mysql_fetch_array($r,MYSQL_ASSOC)){ do { $userarray[] = $getR; } while($getR = mysql_fetch_array($r)); echo 'Done retrieved '.count($getR).' records.'; } else { echo 'there has been an error retrieving the results.'; } Thanks Jarratt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: set multiple variables
try this: if ($REMOTE_ADDR == "212.3.54.65" && $REMOTE_ADDR == "212.3.54.66") Joe Szilagyi wrote: Hi, I have this working: if ($REMOTE_ADDR == "212.3.54.65") { header("Location: http://www.google.com/search?&q=huzzah";); Redirect browser exit; } But I want to specify multiple IPs. What's the best recommended way for doing that? thanks Joe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I produce a random database query for each day or week?
My idea on your problem would be to use a random sql-query selecting a cd from your database. SELECT * FROM my_table ORDER BY RAND() LIMIT 1; This could be placed in a script that is executed only by the first user in a week and the result is stored e.g. in a text file and included in any later call of your website. It's too early in the morning for details (I just stood up), but if you have questions about realization please ask. Dirk. On Fri, 01 Oct 2004 15:45:54 +0200, -{ Rene Brehmer }- <[EMAIL PROTECTED]> wrote: > At 10:31 01-10-2004, Graham Cossey wrote: > >A couple of thoughts: > > > >As you want to cycle through the list rather than randomly (with repetition) > >picking from the list, have you considered storing the last CD shown details > >in the DB? > > > >If each CD has a sequential ID then each week (or day) you increment the > >number which will determine what CD is shown. If the incremented CD id > >exceeds the highest id in the DB, restart back at the first id. > > Just incrementing the ID is not a good idea. It does not allow for the > flexibility required if you suddenly delete a CD in the middle. So it'd be > better doing something like "SELECT * FROM cds WHERE `CDid`>'$LastCDid' ". > Then obviously you'd need to check if the last shown was the last in the > base, you'd get 0 rows. But this can be circumvented by just checking the > number of rows returned, and if the rowcount is < 1, simply do a new SELECT > with CDid > 0. > > >You could also include a column (or two) in the CD info table to record when > >it was last displayed and check that this is > 29 days ago. > > I agree that this would be the easiest way. On every display you do an > update to store the date, then on each page load just calculate how long > ago the CD show must've been shown last. > > >What about cookies? Each visitor could then have their own 'cycle' through > >the list. > > This is a per need basis. With the "last shown date" you don't need the > cookies. > > -- > Rene Brehmer > aka Metalbunny > > If your life was a dream, would you wake up from a nightmare, dripping of > sweat, hoping it was over? Or would you wake up happy and pleased, ready to > take on the day with a smile? > > http://metalbunny.net/ > References, tools, and other useful stuff... > Check out the new Metalbunny forums at http://forums.metalbunny.net/ > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Try http://einx.dyndns.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to install php5 on Fedora Core2
Teng Wang wrote: I have some difficulties when installing php5.0.2 on FC2 I used the default settings: ./configure --with-apxs2=/usr/sbin/apxs build build install The installation is complete but when I test phpinfo() in a .php file from browser, the browser says "Can't find the server" Can't find the SERVER. Make sure apache is running. My FC2 is fully installed and I don't know why the php module doesn't work. I doubt if there is some manual settings are need during the configuration/make/make install, or there is some setting after the installation such as change the default httpd.conf or /etc/php.ini If you had php4 installed, remove php4 stuff from httpd.conf I type php -v, the version is fine, php -i is also correct. But I can't make it work through http. Thanks in advance for any kindly help! eruisi 10/03/2004 04:00:59 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: set multiple variables
Argesson wrote: try this: if ($REMOTE_ADDR == "212.3.54.65" && $REMOTE_ADDR == "212.3.54.66") Joe Szilagyi wrote: Hi, I have this working: if ($REMOTE_ADDR == "212.3.54.65") { header("Location: http://www.google.com/search?&q=huzzah";); Redirect browser exit; } But I want to specify multiple IPs. What's the best recommended way for doing that? thanks Joe Make that: if ($REMOTE_ADDR == "212.3.54.65" || $REMOTE_ADDR == "212.3.54.66") -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: set multiple variables
Daniel Schierbeck wrote: Argesson wrote: try this: if ($REMOTE_ADDR == "212.3.54.65" && $REMOTE_ADDR == "212.3.54.66") Joe Szilagyi wrote: Hi, I have this working: if ($REMOTE_ADDR == "212.3.54.65") { header("Location: http://www.google.com/search?&q=huzzah";); Redirect browser exit; } But I want to specify multiple IPs. What's the best recommended way for doing that? thanks Joe Make that: if ($REMOTE_ADDR == "212.3.54.65" || $REMOTE_ADDR == "212.3.54.66") isn't the || same as && ? Or I missed something? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: set multiple variables
||= OR && = AND -Original Message- From: argesson [mailto:[EMAIL PROTECTED] Sent: 03 October 2004 11:30 To: [EMAIL PROTECTED] Subject: [PHP] Re: set multiple variables Daniel Schierbeck wrote: > Argesson wrote: > >> try this: >> if ($REMOTE_ADDR == "212.3.54.65" && $REMOTE_ADDR == "212.3.54.66") >> >> Joe Szilagyi wrote: >> >>> Hi, I have this working: >>> >>> >>> if ($REMOTE_ADDR == "212.3.54.65") { >>> header("Location: http://www.google.com/search?&q=huzzah";); >>> Redirect browser >>> exit; >>> } >>> >>> >>> But I want to specify multiple IPs. What's the best recommended way for >>> doing that? >>> >>> >>> thanks >>> Joe > > > Make that: > if ($REMOTE_ADDR == "212.3.54.65" || $REMOTE_ADDR == "212.3.54.66") isn't the || same as && ? Or I missed something? -- 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] Re: set multiple variables
$REMOTE_ADDR == "212.3.54.65" || $REMOTE_ADDR == "212.3.54.66" is correct On Sun, 3 Oct 2004 12:39:11 +0100, Graham Cossey <[EMAIL PROTECTED]> wrote: > > ||= OR > && = AND > > > > -Original Message- > From: argesson [mailto:[EMAIL PROTECTED] > Sent: 03 October 2004 11:30 > To: [EMAIL PROTECTED] > Subject: [PHP] Re: set multiple variables > > Daniel Schierbeck wrote: > > Argesson wrote: > > > >> try this: > >> if ($REMOTE_ADDR == "212.3.54.65" && $REMOTE_ADDR == "212.3.54.66") > >> > >> Joe Szilagyi wrote: > >> > >>> Hi, I have this working: > >>> > >>> > >>> if ($REMOTE_ADDR == "212.3.54.65") { > >>> header("Location: http://www.google.com/search?&q=huzzah";); > >>> Redirect browser > >>> exit; > >>> } > >>> > >>> > >>> But I want to specify multiple IPs. What's the best recommended way for > >>> doing that? > >>> > >>> > >>> thanks > >>> Joe > > > > > > Make that: > > if ($REMOTE_ADDR == "212.3.54.65" || $REMOTE_ADDR == "212.3.54.66") > > isn't the || same as && ? Or I missed something? > > -- > 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 > > -- Try http://einx.dyndns.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP (anti) crash policy?
Hello, On 10/02/2004 06:01 PM, Olaf Van Der Spek wrote: AFAIK PHP runs safely in multi-threaded servers. What you can't expect is that PHP handles abnormal situations caused by flaws in the external libraries that PHP links with. When I link with the same library in a C app, this 'abnormal situation' just results in a normal return from 'gzinflate' with an error value. So why is it a flaw in code from zlib? That is not the problem. The problem is that zlib does not seem to be able to detect and deal with corrupted streams. That leads to requesting absurd amounts of memory that the PHP memory allocator has no way to distinguish whether it is an intentional memory space request or something case by an abnormal situation. It is not up to PHP memory allocator to guess what is going on. So it handles like an normal memory allocation, gracefully exits like in any other operations that request space above the configured limits. If zlib was ready to detect corruption it would never request an absurd amount of memory. I do not think it would be wise to change the PHP memory allocator behavior just to deal with zlib inability to detect corruption before asking for exceedingly large memory blocks. Maybe you should try this script on a multi-threaded webserver. Is this also caused by flaws in external libraries? f(); ?> The flaw is in your code as nobody should be writing infinite recursion programs. If you run a similar program in C it will crash exceeding the acceptable calling stack space. I don't know if you do that in PHP that could be avoided as I don't know if PHP can determine whether the stack space was exceeded. Anyway, the only way to deal with this situation is to let the current process exit as there is no way to recover from this situation that is evidently a bug of the script, not of PHP. -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP (anti) crash policy?
Manuel Lemos wrote: Hello, On 10/02/2004 06:01 PM, Olaf Van Der Spek wrote: AFAIK PHP runs safely in multi-threaded servers. What you can't expect is that PHP handles abnormal situations caused by flaws in the external libraries that PHP links with. When I link with the same library in a C app, this 'abnormal situation' just results in a normal return from 'gzinflate' with an error value. So why is it a flaw in code from zlib? That is not the problem. The problem is that zlib does not seem to be able to detect and deal with corrupted streams. That leads to requesting absurd amounts of memory that the PHP memory allocator has no way to distinguish whether it is an intentional memory space request or something case by an abnormal situation. It is not up to PHP memory allocator to guess what is going on. So it It indeed isn't. However, it should be possible for the zlib code to say to the allocator: "Try to allocate this, if that fails, return an error to me instead of aborting the script". handles like an normal memory allocation, gracefully exits like in any other operations that request space above the configured limits. Gracefully, as in aborting/resetting the TCP/HTTP connection? If zlib was ready to detect corruption it would never request an absurd amount of memory. I do not think it would be wise to change the PHP memory allocator behavior just to deal with zlib inability to detect corruption before asking for exceedingly large memory blocks. I disagree, see above. The flaw is in your code as nobody should be writing infinite recursion programs. No, there is A flaw in my code. That doesn't mean it's THE flaw. If you run a similar program in C it will crash exceeding the acceptable calling stack space. I don't know if you do that in PHP that could be avoided as I don't know if PHP can determine whether the stack space was exceeded. Anyway, the only way to deal with this situation is to let the current How can you claim that's the only way if you don't know whether it's avoidable by PHP? process exit as there is no way to recover from this situation that is evidently a bug of the script, not of PHP. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to install php5 on Fedora Core2
Surely apache is running. And I checked httpd.conf. There is no "LoadModule php4.x.x ...". Anyother settings should be removed? The first time I installed php5.0.0, I forgot to add --with-apxs2=/usr/sbin/apxs. It works but the version is 4.3.8 as phpinfo() shows. When I added this option, the php didn't work anymore. But the apache works fine. The browser can read .html files. Anyone can help me? Teng Wang wrote: > I have some difficulties when installing php5.0.2 on FC2 > > I used the default settings: > ./configure --with-apxs2=/usr/sbin/apxs > build > build install > > The installation is complete but when I test phpinfo() in a .php file from browser, > the browser says "Can't find the > server" Can't find the SERVER. Make sure apache is running. > > My FC2 is fully installed and I don't know why the php > module doesn't work. > > I doubt if there is some manual settings are need during the configuration/make/make > install, or there is some setting > after the installation such as change the default httpd.conf or /etc/php.ini If you had php4 installed, remove php4 stuff from httpd.conf > > I type php -v, the version is fine, php -i is also correct. > But I can't make it work through http. > > Thanks in advance for any kindly help! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to install php5 on Fedora Core2
On Sun, 2004-10-03 at 09:43, Teng Wang wrote: > Surely apache is running. > And I checked httpd.conf. There is no "LoadModule php4.x.x > ...". Anyother settings should be removed? > > The first time I installed php5.0.0, I forgot to add > --with-apxs2=/usr/sbin/apxs. It works but the version is 4.3.8 as phpinfo() shows. > When I added this option, the php > didn't work anymore. But the apache works fine. The browser > can read .html files. Redhat splits up the http config file into sub configurations for each module. Check the config file located at: /etc/httpd/conf.d/php.conf Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to install php5 on Fedora Core2
Thanks a lot. It works! But a new problem is: default setting loses all extensions. If I wanna install all extension in the package, how to configure the installation and reinstall? Thanks a lot! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP (anti) crash policy?
Hello, On 10/03/2004 10:18 AM, Olaf Van Der Spek wrote: That is not the problem. The problem is that zlib does not seem to be able to detect and deal with corrupted streams. That leads to requesting absurd amounts of memory that the PHP memory allocator has no way to distinguish whether it is an intentional memory space request or something case by an abnormal situation. It is not up to PHP memory allocator to guess what is going on. So it It indeed isn't. However, it should be possible for the zlib code to say to the allocator: "Try to allocate this, if that fails, return an error to me instead of aborting the script". That would be breaking the normal behavior of PHP memory handling failures. All memory handling failures are currently not recoverable. I think that making all failed memory allocations recoverable is not viable because more PHP C code that makes memory allocations assumes it only returns if it succeeds. Trying to change that everywhere memory is allocated is and monster job that I doubt that any PHP core developer will agree on doing. handles like an normal memory allocation, gracefully exits like in any other operations that request space above the configured limits. Gracefully, as in aborting/resetting the TCP/HTTP connection? Gracefully means not crashing with a core dump. The flaw is in your code as nobody should be writing infinite recursion programs. No, there is A flaw in my code. That doesn't mean it's THE flaw. It is nobody else's fault if you write buggy code. Although it is desirabe to have means to detect program bugs during testing phases, such means may impose performance penalties that may not be reasonable to have in PHP versions running in production. I know there are debugging extensions that can help detecting deep recursion situations. That does not mean that it is good idea to run such extensions on production environments on which you need to have all the performance that you can get. If you run a similar program in C it will crash exceeding the acceptable calling stack space. I don't know if you do that in PHP that could be avoided as I don't know if PHP can determine whether the stack space was exceeded. Anyway, the only way to deal with this situation is to let the current How can you claim that's the only way if you don't know whether it's avoidable by PHP? I do not think that there is a way for PHP to automatically fix a bug in your code . -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to install php5 on Fedora Core2
On Sun, 2004-10-03 at 10:21, Teng Wang wrote: > Thanks a lot. It works! > > But a new problem is: default setting loses all extensions. > If I wanna install all extension in the package, how to > configure the installation and reinstall? There are two ways... you can either compile in the extensions using the appropriate ./configure settings (see "./configure --help" for all available settings), or you can try and find prebuilt extensions and place them in the appropriate extensions dir (for php4 /usr/lib/php4 under redhat, you may want to create a separate one for php5), then you will need to add a .ini file for the module at /etc/php.d/ which loads the prebuilt extension. There are often RPMs that do all this for you, but I don't know that any exist for php5 yet. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP (anti) crash policy?
Manuel Lemos wrote: Hello, I think that making all failed memory allocations recoverable is not viable because more PHP C code that makes memory allocations assumes it only returns if it succeeds. Trying to change that everywhere memory is allocated is and monster job that I doubt that any PHP core developer will agree on doing. You could just create a new function for that: alloc_no_exception There's no need to change every call, you'd only need to change the calls that can take a NULL result. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP (anti) crash policy?
Hello, On 10/03/2004 12:27 PM, Olaf Van Der Spek wrote: I think that making all failed memory allocations recoverable is not viable because more PHP C code that makes memory allocations assumes it only returns if it succeeds. Trying to change that everywhere memory is allocated is and monster job that I doubt that any PHP core developer will agree on doing. You could just create a new function for that: alloc_no_exception There's no need to change every call, you'd only need to change the calls that can take a NULL result. I find it hard to justify such function, but nothing stops you to propose a patch to PHP developers and see if they find acceptable. -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP (anti) crash policy?
Manuel Lemos wrote: Hello, On 10/03/2004 12:27 PM, Olaf Van Der Spek wrote: I think that making all failed memory allocations recoverable is not viable because more PHP C code that makes memory allocations assumes it only returns if it succeeds. Trying to change that everywhere memory is allocated is and monster job that I doubt that any PHP core developer will agree on doing. You could just create a new function for that: alloc_no_exception There's no need to change every call, you'd only need to change the calls that can take a NULL result. I find it hard to justify such function Why? I think a large number of data handling functions would benefit from such a function. And it'd make PHP more robust. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP (anti) crash policy?
Hello, On 10/03/2004 01:46 PM, Olaf Van Der Spek wrote: I think that making all failed memory allocations recoverable is not viable because more PHP C code that makes memory allocations assumes it only returns if it succeeds. Trying to change that everywhere memory is allocated is and monster job that I doubt that any PHP core developer will agree on doing. You could just create a new function for that: alloc_no_exception There's no need to change every call, you'd only need to change the calls that can take a NULL result. I find it hard to justify such function Why? I think a large number of data handling functions would benefit from such a function. And it'd make PHP more robust. Because it is an hack to work around the lack of support for detection of corrupted data in zlib. In the end you will be able to handle the failure of zlib but you will not be able to tell whether it failed because the file was too large to decompress or because it failed due to corrupted data. I think it would be better that zlib would be able to detect corrupted data so you could eventually tell the user that the file is corrupted instead of misleading with a message saying there was not enough memory. -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using PHP4 or PHP5
I would say PHP5, for sure. PHP5 is much better in nearly every way, and more and more people are using it every day. Also, for the most part, PHP4 is backwards compatible with PHP5, so it shouldn't be too much of a problem. I would absolutely recommend upgrading to PHP5. -- Regards, Matthew Fonda On Sat, 2004-10-02 at 12:19, Michael Lauzon wrote: > As I mentioned earlier, I am putting a team together to create a > web-based RPG, different from the one I am currently playing. Would > it be better to use PHP4 with it's strong developer base, or the new > PHP5 which is more object oriented an in my opinion would be easier to > keep the game up to date? > > -- > Michael Lauzon > P.S. This is the game I am playing, but I have ideas that I think can > be done better than what was done for this game -- but everyone always > says that!: > > http://phantasyrpg.com/main.php?view=9898 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to install php5 on Fedora Core2
Howdy, Redhat is notorious for leaving out things, such as apxs. To get php working, you will most likely have to download apache, build it, and install it. Make sure you configure apache with --enable-so. After apache builds, do make install. And then, when configuring php, do ./configure --with-apxs2=/usr/local/apache2/bin/apxs That should work just fine. You can still have your old apache installed at the same time, just don't use it. Copy the config files from the old apache, and do /etc/init.d/httpd stop, then startup the other apache (probably /usr/local/apache2/bin/httpd), and php should be working perfectly -- Regards, Matthew Fonda On Sun, 2004-10-03 at 07:03, Robert Cummings wrote: > On Sun, 2004-10-03 at 09:43, Teng Wang wrote: > > Surely apache is running. > > And I checked httpd.conf. There is no "LoadModule php4.x.x > > ...". Anyother settings should be removed? > > > > The first time I installed php5.0.0, I forgot to add > > --with-apxs2=/usr/sbin/apxs. It works but the version is 4.3.8 as phpinfo() shows. > > When I added this option, the php > > didn't work anymore. But the apache works fine. The browser > > can read .html files. > > Redhat splits up the http config file into sub configurations for each > module. Check the config file located at: > > /etc/httpd/conf.d/php.conf > > Cheers, > Rob. > -- > .. > | InterJinn Application Framework - http://www.interjinn.com | > :: > | An application and templating framework for PHP. Boasting | > | a powerful, scalable system for accessing system services | > | such as forms, properties, sessions, and caches. InterJinn | > | also provides an extremely flexible architecture for | > | creating re-usable components quickly and easily. | > `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regular Expression - highlighting
Aidan Lister wrote: > Hello list, > > I'm pretty terrible with regular expressions, I was wondering if > someone would be able to help me with this > http://paste.phpfi.com/31964 > > The problem is detailed in the above link. Basically I need to match > the contents of any HTML tag, except a link. I'm pretty sure a > lookbehind set is needed in the center (%s) bit. > > Any suggestions would be appreciated, but it's not quite as simple as > it sounds - if possible please make sure you run the above script and > see if it "PASSED". So basically, you want to put a link around "foo", only if it doesn't already have one, right? The problem with look-behind assertions is that they have to be fixed-width. If you're certain of what kind of data you're going to be dealing with then this may be sufficient. For example, I came up with a regex that will PASS your script but I doubt seriously that it'll be very useful to you as it would be easy to break it by coming up with various test cases. For your single test case, however, this works: /(?)(?foo and its infinite variants could not be trapped for with a single regex since you cannot have an infinite number of fixed width look-behind assertions. If quantifying modifiers such as '*', '+', and '?' were allowed in look-behind assertions it would be possible, but they aren't (see "man perlre"). If your data is coming from unknown sources you'll probably have to use a full fledged HTML parser to pull out text that isn't already part of an tag. I know there are several of these available for perl and I'm sure there are for PHP too but I'm unaware of them. Sorry if this isn't terribly helpful. Maybe I'm overlooking something and someone else will point out a simple way to accomplish what you're trying to do... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] A problem of installation
Howdy, Redhat is notorious for leaving out things, such as apxs. To get php working, you will most likely have to download apache, build it, and install it. Make sure you configure apache with --enable-so. After apache builds, do make install. And then, when configuring php, do ./configure --with-apxs2=/usr/local/apache2/bin/apxs That should work just fine. You can still have your old apache installed at the same time, just don't use it. Copy the config files from the old apache, and do /etc/init.d/httpd stop, then startup the other apache (probably /usr/local/apache2/bin/httpd), and php should be working perfectly -- Regards, Matthew Fonda On Sat, 2004-10-02 at 21:27, Robert Cummings wrote: > On Sun, 2004-10-03 at 00:05, Teng Wang wrote: > > I met with a problem when installing php5.0.0 on my Federo Core 2.0 system. > > > > I use the default settings: > > ./configure > > make > > make install > > > > Everything is ok, but when I test my phpinfo(),it always shows the > > 4.3.8 version. Yet, when I type the following command > > php -v > > to show the version of php, it's 5.0.0 > > > > What's the problem? Any kindly help would be appreciated. > > Where are you loading phpinfo()? If it is in browser then there's a good > chance you've only built the cgi/cli version and not the module. The > module version needs the --with-apxs flage enabled. > > Cheers, > Rob. > -- > .. > | InterJinn Application Framework - http://www.interjinn.com | > :: > | An application and templating framework for PHP. Boasting | > | a powerful, scalable system for accessing system services | > | such as forms, properties, sessions, and caches. InterJinn | > | also provides an extremely flexible architecture for | > | creating re-usable components quickly and easily. | > `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to install php5 on Fedora Core2
Howdy, When you configure, you need to make sure you have --with-ext= or --enable-ext for all the extensions you want to use. If you want all the same extensions from your previous install, you could copy and paste them out of the configuration command of your old phpinfo() page. If you try and use mysql, you may get an error about header files being missing, you need to copy the mysql .h files into the include directory for mysql. Also, if you dont want to re compile the entire thing, you can compile extensions separately, and load them with either dl() in a script, or just add them to php.ini -- Regards, Matthew Fonda On Sun, 2004-10-03 at 07:21, Teng Wang wrote: > Thanks a lot. It works! > > But a new problem is: default setting loses all extensions. > If I wanna install all extension in the package, how to > configure the installation and reinstall? > > Thanks a lot! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: set multiple variables
On Sun, 2004-10-03 at 04:39, Graham Cossey wrote: > isn't the || same as && ? Or I missed something? No, || is OR, and && is AND Check out http://www.php.net/manual/en/language.operators.logical.php -- Regards, Matthew Fonda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: set multiple variables
Matthew Fonda wrote: On Sun, 2004-10-03 at 04:39, Graham Cossey wrote: isn't the || same as && ? Or I missed something? No, || is OR, and && is AND Check out http://www.php.net/manual/en/language.operators.logical.php OK, sorry, my mistake. And thanks. newbie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: set multiple variables
Matthew Fonda wrote: On Sun, 2004-10-03 at 04:39, Graham Cossey wrote: isn't the || same as && ? Or I missed something? No, || is OR, and && is AND Check out http://www.php.net/manual/en/language.operators.logical.php Wll - sort of. The precedence level can be tricky, sometimes "||" doesn't act like "or" (and the same with "&&" and "and"). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HOWTO: Install PHP on Fedora Core / Redhat
Howdy, I noticed that quite a few people were having a hard time installing PHP on Fedora Core or Redhat, so I put together a little tutorial explaining how to do it. Hope it helps :D http://mfonda.dotgeek.org/fcrh.php -- Regards, Matthew Fonda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to install php5 on Fedora Core2
Finally I succeeded on the installation. Just manually add all --with-EXTENSIONS and remove all unvailable ones. The procedure is too completed. I hope there should be some scripts which automatically check the availability of each extension and generate the configuration file. Anyway, thanks a lot to all warm-hearted experts! Eruisi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Why my browser always chooses UTF-8 charset?
Although I have included charset (GB2312) information in my html/php files. And my browser has "Auto-select" settings. How to make the browser select charset correctly, eruisi 10/03/2004 17:53:14 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why my browser always chooses UTF-8 charset?
Look for this in your php.ini: default_charset Cheers, Rob. On Sun, 2004-10-03 at 17:56, Teng Wang wrote: > Although I have included charset (GB2312) information in my > html/php files. > > > > And my browser has "Auto-select" settings. > How to make the browser select charset correctly, > > > eruisi > 10/03/2004 > 17:53:14 -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why my browser always chooses UTF-8 charset?
Hi: But I still want the default language to be English, I can set a page to be Chinese if I wanna to do so. Is that possible? Why doesn't the meta information work? Teng Wang 2004/10/03 18:03:54 >At Sun, 03 Oct 2004 18:04:10 -0400 ,You wrote: > Look for this in your php.ini: > > default_charset > > Cheers, > Rob. > > On Sun, 2004-10-03 at 17:56, Teng Wang wrote: > > Although I have included charset (GB2312) information in my > > html/php files. > > > > > > > > And my browser has "Auto-select" settings. > > How to make the browser select charset correctly, > > > > > > eruisi > > 10/03/2004 > > 17:53:14 > -- > .. > | InterJinn Application Framework - http://www.interjinn.com | > :: > | An application and templating framework for PHP. Boasting | > | a powerful, scalable system for accessing system services | > | such as forms, properties, sessions, and caches. InterJinn | > | also provides an extremely flexible architecture for | > | creating re-usable components quickly and easily. | > `' * * Teng Wang * * Univ. of Mass. Amherst * ECE Department * USA * * (Lab)1-413-545-0923 * (E-mail)[EMAIL PROTECTED] * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why my browser always chooses UTF-8 charset?
On Sun, 03 Oct 2004 18:05:32 -0400, Teng Wang <[EMAIL PROTECTED]> wrote: Hi: But I still want the default language to be English, I can set a page to be Chinese if I wanna to do so. Is that possible? Why doesn't the meta information work? Setting the charset in the html doesn't work very well for the simple reason that the parser has to decide on a charset before it can even read the tag. Note that UTF-8 will allow you to freely mix English and Chinese without problems. -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to install php5 on Fedora Core2
Teng Wang wrote: Finally I succeeded on the installation. Just manually add all --with-EXTENSIONS and remove all unvailable ones. The procedure is too completed. I hope there should be some scripts which automatically check the availability of each extension and generate the configuration file. Anyway, thanks a lot to all warm-hearted experts! Eruisi You mean something like --enable-all. But then you would not know which extensions are installed and which are not. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why my browser always chooses UTF-8 charset?
Teng Wang wrote: Although I have included charset (GB2312) information in my html/php files. And my browser has "Auto-select" settings. How to make the browser select charset correctly, W3C: Conforming user agents must observe the following priorities when determining a document's character encoding (from highest priority to lowest): 1. An HTTP "charset" parameter in a "Content-Type" field. 2. A META declaration with "http-equiv" set to "Content-Type" and a value set for "charset". 3. The charset attribute set on an element that designates an external resource. In addition to this list of priorities, the user agent may use heuristics and user settings. For example, many user agents use a heuristic to distinguish the various encodings used for Japanese text. Also, user agents typically have a user-definable, local default character encoding which they apply in the absence of other indicators. So the solution should be: header('Content-Type: text/html; charset=gb2312'); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP4: getting a dom xml node's namespace
hi there I'm parsing xml documents with php4's DOM extension and I would like to be able to see what namespaces are in the document. Is there any way to get at the xmlns attributes? Or a way to get the namespace of a node (not just the prefix). thanks -jachin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to install php5 on Fedora Core2
Hi,Marek Kilimajer: I had to test each module. That's why I said it's too complicated (sorrry for the typo). Is there any script to test it automatically? Teng Wang 2004/10/03 19:57:23 >At Mon, 04 Oct 2004 01:37:38 +0200 ,You wrote: > Teng Wang wrote: > > Finally I succeeded on the installation. Just manually add > > all --with-EXTENSIONS and remove all unvailable ones. The > > procedure is too completed. I hope there should be some > > scripts which automatically check the availability of each > > extension and generate the configuration file. > > > > Anyway, thanks a lot to all warm-hearted experts! > > > > Eruisi > > > > You mean something like --enable-all. But then you would not know which > extensions are installed and which are not. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php * * Teng Wang * * Univ. of Mass. Amherst * ECE Department * USA * * (Lab)1-413-545-0923 * (E-mail)[EMAIL PROTECTED] * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP (anti) crash policy?
On October 3, 2004 12:46, Olaf van der Spek wrote: > Manuel Lemos wrote: > > Hello, > > > > On 10/03/2004 12:27 PM, Olaf Van Der Spek wrote: > >>> I think that making all failed memory allocations recoverable is not > >>> viable because more PHP C code that makes memory allocations assumes > >>> it only returns if it succeeds. Trying to change that everywhere > >>> memory is allocated is and monster job that I doubt that any PHP core > >>> developer will agree on doing. > >> > >> You could just create a new function for that: alloc_no_exception > >> There's no need to change every call, you'd only need to change the > >> calls that can take a NULL result. > > > > I find it hard to justify such function > > Why? > I think a large number of data handling functions would benefit from > such a function. > And it'd make PHP more robust. Olaf, PHP is an open source language is it not? Since you're so smart why don't YOU write the code? -- Regards, David Bevan http://www.getanyideas.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: HOWTO: Install PHP on Fedora Core / Redhat
On 10/3/2004 4:02 PM Matthew Fonda wrote: Howdy, I noticed that quite a few people were having a hard time installing PHP on Fedora Core or Redhat, so I put together a little tutorial explaining how to do it. Hope it helps :D http://mfonda.dotgeek.org/fcrh.php I'm not complaining about any tutorials, but this doesn't quite fit with my experience. I installed FC2 (not an upgrade). I then ran phpinfo() to get the configure options for the installed PHP. I used those options to configure PHP5. After running make and make install, I edited "/etc/httpd/conf.d/php.ini" to change the LoadModule line. I believe I also needed to remove the domxml.ini file from /etc/php.d. I may have also needed to more some other files around. My point isn't to provide another tutorial, but to say that a PHP and linux newbie (me) can install PHP5 without also installing Apache. I am inexperienced with Apache and PHP, so I'm not claiming it is *better* not to re-install Apache, just that it isn't necessary under FC2. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] output a PDF, over header(). causes corruption on the file?
Im trying to output a pdf over a browser so i can hide the url link to it. but this one causes corruption. Try this.. http://dev.axishift.com/php/getpdf.php i got this part.. "Note: There is a bug in Microsoft Internet Explorer 4.01 that prevents this from working. There is no workaround. There is also a bug in Microsoft Internet Explorer 5.5 that interferes with this, which can be resolved by upgrading to Service Pack 2 or later. " but im using netscape, and it still has error. here's the basic source for it.. what other alternatives can you suggest? i need this asap! please help. -- Louie Miranda http://www.axishift.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Downloadcounter
I'm writing a file-download system. In order to download, the user will have to login with username and password. Now, how do I feed the file to the user if it's not under htdocs? Or should the files be under htdocs (in subdirs of course) and have some .htaccess limitations? There is a chance that some files can be several gigs big. Will this be a problem? //Simon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: output a PDF, over header(). causes corruption on the file?
this is one problem i haven't seen some exact solutions. i tried this instead.. header("Content-type: application/pdf"); header("Content-transfer-encoding: binary"); header("Content-Disposition: attachment; filename=list.pdf"); $fp = fopen($WCFPriceList, "rb"); fpassthru($fp); and it did work. but im still waiting for other people's comment. On Mon, 4 Oct 2004 09:24:33 +0800, Louie Miranda <[EMAIL PROTECTED]> wrote: > Im trying to output a pdf over a browser so i can hide the url link to > it. but this one causes corruption. > > Try this.. > http://dev.axishift.com/php/getpdf.php > > i got this part.. > "Note: There is a bug in Microsoft Internet Explorer 4.01 that > prevents this from working. There is no workaround. There is also a > bug in Microsoft Internet Explorer 5.5 that interferes with this, > which can be resolved by upgrading to Service Pack 2 or later. " > > but im using netscape, and it still has error. > > here's the basic source for it.. > > // We'll be outputting a PDF > header('Content-type: application/pdf'); > > // It will be called downloaded.pdf > header('Content-Disposition: attachment; filename="downloaded.pdf"'); > > // The PDF source is in original.pdf > readfile('original.pdf'); > ?> > > what other alternatives can you suggest? i need this asap! please help. > > -- > Louie Miranda > http://www.axishift.com > -- Louie Miranda http://www.axishift.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Downloadcounter
Hi, Simon Fredriksson wrote: I'm writing a file-download system. In order to download, the user will have to login with username and password. Now, how do I feed the file to the user if it's not under htdocs? Or should the files be under htdocs (in subdirs of course) and have some .htaccess limitations? This topic is often discusses in this board and you will find tons of solutions in the archives. In short all you need to do is open the file, read it's contents and write it to the output stream - of course you will need to send the correct headers first. There is a chance that some files can be several gigs big. Will this be a problem? no. //Simon -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 128 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie needs help with MySQL and multiple databases
Hi, im fairly new to php and mysql and need a little help. im running a forum community and would like to have it run on multiple databases because of performance issues others have encountered using the same software on on database. My question is is it possible to have the software connect to 2 different databases depending on which is needed? and if so will users need to login again when accessing the second database (their user info will only be on the second database.) Thank You -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Newbie needs help with MySQL and multiple databases
Matthew wrote: Hi, im fairly new to php and mysql and need a little help. im running a forum community and would like to have it run on multiple databases because of performance issues others have encountered using the same software on on database. My question is is it possible to have the software connect to 2 different databases depending on which is needed? and if so will users need to login again when accessing the second database (their user info will only be on the second database.) Thank You Users shouldn't have to log in, the whole process should be transparent. But how, that would depend on what data you want to get from where, (I gather the 2nd db would be on a different machine?). You'll usually have to edit the files to get something like that done =/ - Tularis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] simple math computation..
the percent of 20% is = .20 right? how can i compute the correct value for this? my $totalCost is $4,000 and when i compute it to .20 using this method.. $shippingestimate = $totalCost * .20; i get the value for the shippingestimate = $0.8 which is wrong.. it should $800 what seems to be wrong? -- Louie Miranda http://www.axishift.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] simple math computation..
On Monday 04 October 2004 15:26, Louie Miranda wrote: > the percent of 20% is = .20 right? 'don't know what's "the pecent of 20% is" ;) but in decimal form, yes, it's right. Or, just ".2" or "0.2". > how can i compute the correct value for this? > > my $totalCost is $4,000 and when i compute it to .20 using > this method.. > > $shippingestimate = $totalCost * .20; > > i get the value for the shippingestimate = $0.8 which is > wrong.. it should $800 what seems to be wrong? Formatting problem, most likely. Try this: * I changed the "E" on $shippingEstimate on purpose :) -- - E - copperwalls was here ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php