[PHP] __autoload() no workie on my 5.2 install...
Hey all. This is my first post, 'coz it's the first time I've ever had such a confusing problem with PHP. I recently got a VPS and compiled PHP 5.2.1 with the following options: --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/etc/php5 --with-curl --with-curl-dir=/usr/local/lib --with-gd --with-gd-dir=/usr/local --with-gettext --with-jpeg-dir=/usr/local/lib --with-kerberos --with-mcrypt --with-mhash --with-mysql=/usr --with-pear --with-png-dir=/usr/local/lib --with-xml --with-zlib --with-zlib-dir=/usr/local/lib --with-zip --with-openssl --enable-bcmath --enable-calendar --enable-ftp --enable-magic-quotes --enable-sockets --enable-track-vars --enable-mbstring --enable-memory-limit --with-freetype-dir=/usr/include/freetype2 --enable-soap --with-mysql-sock=/tmp/mysql.sock Apache is 2.2.4 and was also hand-compiled. Meanwhile, at home, I have PHP 5.1.6 and Apache 2.2.3. At home, __autoload() works great. On the VPS, it doesn't work at all. Here is a small case: = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = test.php: boo; ?> = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = foo.php: boo = "I wouldn't say 'boo' if this autoloader worked on my server...\n"; } } ?> = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = And, the crying begins: [EMAIL PROTECTED] ~]$ php test.php Fatal error: Cannot instantiate non-existent class: foo in /home/nhawks/test.php on line 5 Naturally for this simple test case, both files are in the same directory. When I do the same thing at home... [EMAIL PROTECTED] ~]$ php test.php I wouldn't say 'boo' if this autoloader worked on my server... I don't understand why __autoload() would fail, I didn't explicitly enable it when compiling at home and I can't find anything via Google to help ... No clues whatsoever in my Apache error_log. When I try throwing: echo("Got here!\n"); ..into my __autoload() function, it reveals that __autoload() is never being fired. Please help. Nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Weird mystery error
Hey all, I wrote a symfony app this week for a client, and I'm trying to install it on their server today. I am getting a Fatal that I can only assume is either an Apache 1.3.37 bug, or a PHP 5.2.4 bug. It's madness. PHP is reporting an undefined function, but it's undefined because it's only a few random letters of the actual function expression in the code. It's parsing random substrings as functions. Check this out: Source of /search/search.php: Line 1: getController()->dispatch();
Re: [PHP] Weird mystery error
I don't use lists regularly, sorry for the double-reply to Nathan. Sadly: - no ssh on the client box - can't 100% mimic because I have a different Apache However, I did use symfony freeze to move all the Pear modules etc that it needs, into the local site. An additional clue might be: the first problem I had was that autoloading wasn't working at all, until I moved all the files it needed into one of the symfony lib dirs (it wouldn't seek into my app dirs) I see a couple things in their phpinfo that concern me... does anybody see a warning flag here? The customer's site was compiled with --enable-force-cgi-redirect ... and the server_software row says PHP5 was compiled CGI only... mine was compiled with apxs2. They have something called sourceguardian, never heard of it but my source was fine till this webserver got ahold of it... ? Ps: I have 4 other apps installed in this project and they all work fine :\ Believe me, in a file as short as a symfony front controller, and after checking about 40 times, I'm pretty sure the file is OK :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Weird mystery error
I think I misunderstood the question. All 5 apps in the project are installed on their server, and all working at 99-100% except this one. (can't be sure the rest is bug free because this is my white whale at the moment) On Sat, 2007-10-13 at 13:13 -0400, Nathan Nobbe wrote: > On 10/13/07, Nathan Hawks <[EMAIL PROTECTED]> wrote: > Ps: I have 4 other apps installed in this project and they > all work > fine :\ Believe me, in a file as short as a symfony front > controller, > and after checking about 40 times, I'm pretty sure the file is > OK :) > > is this the first symphony app you have on the box? > > -nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Dang lack of a list reply button
I have only done this when I am building the function name using a string expression, so my advice might not be necessary in your case but it has worked for me: {$function}($var); In that case, the curly braces equate to the eval() function in Javascript. Jay Blanchard wrote: > I don't think you can put a function name in a variable and call it like > $function($var). Yes you can - it's basically the same as variable variables. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] This, then that.
If by "creates a web page" you just mean it echos output to the browser, and you want to do something else after that, then: After you have sent your and have no more output for the browser, just use the include() function to run your extra process. e.g On Thu, 2007-10-18 at 20:19 -0400, TG wrote: > Describe the process a little more. > > PHP script outputs HTML to the browser? > > PHP script outputs HTML to a file? > > Is the file created then displayed? > > Is the PHP script run via command line? If so, then exec() and some of the > other ideas would probably be the way to go. > > If it creates and displays a page online, you can use a "headler(Location: > someurl)" to redirect. This is subject to user interference of course. > > Do you need it to spawn the other PHP script and exit or is it ok if it's a > child process of the original php script (or whoever that works.. sorry, > not 100% familiar with the internal stuff). > > -TG > > - Original Message - > From: tedd <[EMAIL PROTECTED]> > To: > Date: Thu, 18 Oct 2007 15:04:36 -0400 > Subject: [PHP] This, then that. > > > Hi gang: > > > > I would like to run a php script that creates a web page and AFTER it > > is finished creating the page, then it runs another php script -- how > > you do that? > > > > Cheers, > > > > tedd > > > > -- > > --- > > http://sperling.com http://ancientstones.com http://earthstones.com > > > > -- > > 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
[PHP] Multi-table pager sorted by date
I'm doing a project where the database was designed before me and they don't have a budget for a database re-design. There are two entity tables which /should/ have been the same model with some meta-fields keyed off a type field, but it's not. It's two tables, which should be displayed intermixed, paged, and sorted by date. The solution I thought up didn't do the trick. I: - made two pagers, one for each table - got the current page's set - intermixed them by making an array of references, keyed off the datetime string, refering to items in both result sets - krsort()ed the intermixed array The result is probably obvious, but I'll explain it anyway... there is nowhere near an equal density in entries-per-date between the two tables, and so, each page shows results from both tables, but the dates for the two models on the same page are very different; on page 1, i'll get items from tableA with dates ranging 10/5/2007-10/9/2007 and tableB with dates ranging from 10/13/2007 12:00:00 to 10/13/2007 at 15:00:00. So I'm thinking I need to find a way to align the results, and it needs to happen somehow in the pagers themselves (this being symfony, the pager grabs the query criteria object and sets limit and offset for you.) I am already generating pager links based on the resultset with the most pages; so artificially generating page links won't be a far step. The only solution I've thought up, I don't want to do, which is to break the query into dates e.g. if the date range is 2007-10-01 to 2007-10-31, I do not want a separate pager link for each date which then subpages the results or shows all results for that date; the date range might span years and there might be hundreds of entries for a date. I need a single pager which aligns the two tables' entries' dates in each page of results throughout the span. I am very open to a ready-made class that can do this, especially if it's based on Propel, or if it can take raw sql queries. Thoughts? Nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Securing PHP
Are you running a multi-user hosting service? If so you can create include files on a per-user or per-domain basis. Use the Apache config directive php_value to set your include_path and open_basedir appropriately for each account; and other options as desired. I don't know of a particular site, but that is the config framework that Plesk uses. As for building PHP, make sure you run the testing battery ('make test' after you 'make' and before you 'make install') in order to see how 'hardened' your build is. On Sat, 2007-10-20 at 21:00 -0400, Grant wrote: > Hi all, > > You've all likely heard this before"I was hacked..." , "Had register > globals on..." etc etc. > > Well, this is true of me as well. > > Does anyone know of a site that would help a semi professional lock down > php, i.e. > > Perhaps how to install phpsuexec, > > Jail users to only have the ability to read/write to thier own files and > directories, > > php.ini directives that have simiar affect as mentioned above. > > Any help appreciated. > > -Grant > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Multi-table pager sorted by date
Nevermind. Just because they can't afford a database redesign doesn't mean they can't afford a new index table containing date-indexed links to both tables entities. On Sat, 2007-10-20 at 21:39 -0400, Nathan Hawks wrote: > I'm doing a project where the database was designed before me and they > don't have a budget for a database re-design. There are two entity > tables which /should/ have been the same model with some meta-fields > keyed off a type field, but it's not. It's two tables, which should be > displayed intermixed, paged, and sorted by date. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Multi-table pager sorted by date
Possibly... I've never read about MySQL views, so I can't refute it :) The problem at hand is solved, but thanks. Might have to give views a glance in TFM. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with foreach
Also, AFAIK, PHP has always thrown a warning or notice if you use foreach() on a non-associative array. That doesn't mean it won't work, but the strict standard is apparently: foreach ($assoc as $key => $val) not foreach ($indexed as $item) However, as we all know, the latter still works fine. Despite the warning/notice you see, the code is probably still working as expected (any other problems aside). If you like to keep error reporting on, you can just use an @ to suppress that error. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] EMPTY??
Note: empty() only checks variables as anything else will result in a parse error. In other words, the following will not work: empty(trim($name)). http://www.php.net/manual/en/function.empty.php On Tue, 2007-10-23 at 13:20 -0400, Dan Shirah wrote: > I am having some issues with empty(). > > On my page I have a text area: > > width="680"> > > Comments: >wrap="soft"> > > > > > I then submit my page and on the following page I put the posted value into > two variables. > > $comments = strtoupper($_POST['comments']); > $check_comments = $_POST['comments']; > > I made two variables for the same posted value because I believe empty() > does not work with strtoupper in front of the value. It only works with a > standalone variable, correct? > > So, once I have assigned my comments to a variable I am doing: > > if(!empty($check_comments)) { > echo "Do Something"; > } > > However, if the comments textarea is left blank I just get a generic error > "Changed database context to database" > > I've tried the below and get the same result: > if($check_comments != "") { > echo "Do Something"; > } > > When comments is left blank and I echo out the value for $check_comments it > returns nothing at all which is why I think empty() or "" should work, but > they don't. > > Ideas? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] libmm.so.14
http://www.qmailrocks.com/ I am mailserver-challenged and I changed my VPS from exim to qmail with only one practice run using their guides, patch-kits, and add-on bundles. On Tue, 2007-10-23 at 10:52 -0400, Jeff Mckeon wrote: > > -Original Message- > > From: Daniel Brown [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, October 23, 2007 10:47 AM > > To: Jeff Mckeon > > Cc: php-general@lists.php.net > > Subject: Re: [PHP] libmm.so.14 > > > > On 10/23/07, Jeff Mckeon <[EMAIL PROTECTED]> wrote: > > > Hey all, > > > > > > Setting up a php based ticket system on a new OpenSuse 10.3 64bit > > system. > > > > > > The ticket sys requires qmail so I had to uninstall postfix and > > install > > > qmail. > > > > > > Qmail injects emails into this ticket sys with the following line... > > > > > > /usr/bin/php -q /srv/www/virtual/support/mailpipe.php > > > > > > I now get this error however: > > > > > > /usr/bin/php: error while loading shared libraries: libmm.so.14: > > cannot open > > > shared object file: No such file or directory > > > > > > Libmm.so.14 is installed in: > > > > > > /usr/lib64/libmm.so.14 > > > > > > Any idea what it is I'm missing? > > > > > > Version PHP5 > > > > > > Thanks, > > > > > > jeff > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > Check to see where PHP is searching for the extensions. Chances > > are, all you'll need to do is symlink it from the /usr/lib64/ > > directory to wherever PHP is expecting to find it. > > > > Also, be sure it really is still there. When's the last time you > > did a `locate -u` on your server (if that's the method you used)? It > > could be showing an old slocatedb. > > > > -- > > Daniel P. Brown > > [office] (570-) 587-7080 Ext. 272 > > [mobile] (570-) 766-8107 > > > > Give a man a fish, he'll eat for a day. Then you'll find out he was > > allergic and is hospitalized. See? No good deed goes unpunished > > Tried that, > > I did a simlink to /usr/lib but it complained that: > > /usr/bin/php: error while loading shared libraries: libmm.so.14: wrong ELF > class: ELFCLASS64 > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] EMPTY??
Wow, OK... Can you get this same error reducing a copy of the the script down to just core PHP, and that scenario? If so, what version of PHP on what OS is giving you this error? I have seen PHP give some incredibly wonky errors and sometimes they had nothing at all to do with the part of the code it was reporting about, and nothing to do with the message it chose to cough up. Story of my joining the list actually. On Tue, 2007-10-23 at 13:59 -0400, Dan Shirah wrote: > doing a var_dump($_POST['comments']; > > returns string(0) "" > > So the value of $comments in $comments = $_POST['comments']; SHOULD be equal > to 0 or "", right? > > In which case when I do my original: > > if (!empty($comments)) { > echo "Do Something"; > } > > It SHOULD just bypass that and continue with my code, but instead it gives > me the error, "Changed database context to Database." > > > On 10/23/07, Nathan Nobbe <[EMAIL PROTECTED]> wrote: > > > > On 10/23/07, Dan Shirah <[EMAIL PROTECTED]> wrote: > > > > > > I made two variables for the same posted value because I believe empty() > > > does not work with strtoupper in front of the value. It only works with > > > a > > > standalone variable, correct? > > > > > > no; strtoupper modifies its argument, that is all. > > empty evaluates the argument it is given that is all. > > therefore, if empty is passed an string with no contents that has been > > passed through > > strtoupper, it will still be regarded as empty. > > > > > $var = strtoupper(''); > > if(empty($var)) { echo 'var is empty'; } > > ?> > > > > > > > > > When comments is left blank and I echo out the value for $check_comments > > > it > > > returns nothing at all which is why I think empty() or "" should work, > > > but > > > they don't. > > > > > > try using var_dump(); you will see that it is a string that has no > > contents, or perhaps some > > whitespace characters. > > > > > > -nathan > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session vars in parent dir
Howdy all, I have a login app that runs at: DOCUMENT_ROOT/admin/index.php and an AJAX action at: DOCUMENT_ROOT/somefile.php The login app and all the scripts based under the admin/ folder have no problems, but the AJAX scripts don't know jack about any stinkin $_SESSION var. I can only presume this is an issue with the folder. I added this to both the layout code and the Ajax handler script: echo ""; print_r($_SESSION); echo ""; (with an exit() after that in the Ajax action handler) And I get the full session explanation in the layout but I get Array ( ) from the Ajax script. session_start() is being called as the first line of the Ajax script. Any thoughts? Nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] re: session question
Nevermind... I don't know what the problem is yet but it's not the folder. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] More about my weird session
session_module_name() returns 'files' for both. Altering the session.cookie_path (to set it to /) and session.cookie_domain (to set it to '') did not help. Moving the files to DOCUMENT_ROOT where the Ajax scripts are didn't help; the main app still has the session, the Ajax script still doesn't. :( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Talking to myself about sessions [Solved]
It was a symfony thing. For anyone else's future reference, if you are integrating with some big monolith of an app and you find that your sessions are "disconnected" when going from the big app to your little script... check out session_name(). K bye! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php