[PHP] sessions working? not working?
Hi List, Hi have the following (below) session code at the top of each page.. The 'print_r' (development feature only) confirms that on one particular page I do log out as the session var = (). but, on testing that page via the URL I still get to see the page and all its contents - session var() -.. the page has the following 'session_start, DOCTYPE Info then htmlheadcontaining meta info title/headbodycontaining style/tables/content//body/html // end of page. I have copied the same page without the html content (i.e. a blank page) and I get to fully log out.. when this page is tested in the URL my warning comes up 'you need to login to see this page' which is what I want but, I've tried numerous avenues to reconcile my problem to no avail.. I'm a novice so any help would be appreciated.. ?php session_start(); error_reporting (E_ALL ^ E_NOTICE); $userid = $_SESSION['userid']; $username = $_SESSION['username']; print_r($_SESSION); ?
Re: [PHP] sessions working? not working?
On Aug 12, 2013, at 4:27 AM, Clifford Shuker clifford.shu...@ntlworld.com wrote: Hi have the following (below) session code at the top of each page.. The 'print_r' (development feature only) confirms that on one particular page I do log out as the session var = (). but, on testing that page via the URL I still get to see the page and all its contents - session var() -.. the page has the following 'session_start, DOCTYPE Info then htmlheadcontaining meta info title/headbodycontaining style/tables/content//body/html // end of page. I have copied the same page without the html content (i.e. a blank page) and I get to fully log out.. when this page is tested in the URL my warning comes up 'you need to login to see this page' which is what I want but, I've tried numerous avenues to reconcile my problem to no avail.. I'm a novice so any help would be appreciated.. ?php session_start(); error_reporting (E_ALL ^ E_NOTICE); $userid = $_SESSION['userid']; $username = $_SESSION['username']; print_r($_SESSION); ? Ok, but when are you populating the SESSION's? Such as: $_SESSION['userid'] = $userid; Also, have a look at this: http://sperling.com/php/authorization/log-on.php It might help. tedd ___ tedd sperling tedd.sperl...@gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] List working?
[snip] y u no help me !! i have white page withg my php codes in my page ! help please !! asap please i put codes in my file and is white [/snip] You put code in your e-mail? Or code in your web page? If it is your web page you need to start a new thread and post the code that you used so that we can help trouble-shoot. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PDO working via Apache but not at the command line?
It's most likely because both cli and web modules are using different php.ini config files. See what the output of a phpinfo() call in both browser and command line. Thanks, Ash http://www.ashleysheridan.co.uk - Reply message - From: Scott Baker bak...@canbytel.com Date: Mon, Oct 18, 2010 21:20 Subject: [PHP] PDO working via Apache but not at the command line? To: p...@lists.php.net, php-general@lists.php.net I have the following very simple script that uses PDO/FreeTDS to connect to a mssql server. I have PHP Version 5.3.3 running on Linux under Apache. When I view this script via apache/firefox I get proper output. If I try and run this via the command line like php db_dump.php I get an error connecting to the DB: Unable to connect to Omnia: SQLSTATE[HY000] Unable to connect: Adaptive Server is unavailable or does not exist (severity 9). Does Apache call PHP differently than the cli would? Why would Apache method work find, but direct from the command line cause a problem? Do I need to call php from the cli with some other argument? -- $num || $num = 197804; $dbh = omnia_connect(); $sql = EXECUTE P_SaaS_AccountServiceFeatures_Retrieve $num; $sth = $dbh-prepare($sql); $sth-execute(); $foo = $sth-fetchAll(PDO::FETCH_ASSOC); foreach ($foo as $i) { if ($i['ItemStatus'] != 'I') { $out .= $i['Component'] . \n; } } print $out; function omnia_connect() { putenv('FREETDSCONF=/etc/freetds.conf'); $db = DB_NAME; $user = user; $pass = pass; $dsn = dblib:host=Omnia;dbname=$db; try { $dbh = new PDO($dsn, $user, $pass); } catch (PDOException $e) { echo 'Unable to connect to Omnia: ' . $e-getMessage(); exit; } return $dbh; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PDO working via Apache but not at the command line?
On 10/18/2010 02:17 PM, a...@ashleysheridan.co.uk wrote: It's most likely because both cli and web modules are using different php.ini config files. See what the output of a phpinfo() call in both browser and command line. I didn't even think about it parsing different php.ini files. Checking the output of phpinfo() I see it's calling the same php.ini (/usr/local/lib/php.ini) though. :( -- Scott Baker - Canby Telcom System Administrator - RHCE - 503.266.8253 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PDO] Re: [PHP] PDO working via Apache but not at the command line?
Things to check: - Environment: what env vars are set or not set in your Apache vs. CLI - Owner: are you running as the same user as your web server? - Do you or the web server have some kind of rc file that might impact how things run? Suggestion: Use sudo -u webserverusername -s to run a shell as your web server user, then try to run the CLI. Get the environment to match up with your webserver. If this still doesn't work, it might be something more esoteric; check to see if you have other apache modules loaded that might also use FreeTDS or ODBC and that might be messing with things. Use strace php db-dump.php to see what the CLI is up to. Use strace -p apachepid to see what the Apache version is up to (probably want to run apache -X to make this easier). --Wez. On Oct 18, 2010, at 5:26 PM, Scott Baker wrote: On 10/18/2010 02:17 PM, a...@ashleysheridan.co.uk wrote: It's most likely because both cli and web modules are using different php.ini config files. See what the output of a phpinfo() call in both browser and command line. I didn't even think about it parsing different php.ini files. Checking the output of phpinfo() I see it's calling the same php.ini (/usr/local/lib/php.ini) though. :( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PDO] Re: [PHP] PDO working via Apache but not at the command line?
On 10/18/2010 06:27 PM, Wez Furlong wrote: Things to check: - Environment: what env vars are set or not set in your Apache vs. CLI - Owner: are you running as the same user as your web server? - Do you or the web server have some kind of rc file that might impact how things run? Wez you're a genius. When I ran it as the same user as apache it works fine. That got me thinking that it makes a log in /tmp. Checking the log it was only writable by the apache user. A little chmod later and now my script runs perfectly under apache and cli. Thanks for helping me think outside the box. I spent all day puzzled by this, you just made my night. - Scott -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PDO] Re: [PHP] PDO working via Apache but not at the command line?
Sounds like the error message SQLSTATE[HY000] Unable to connect: Adaptive Server is unavailable or does not exist (severity 9) could be more informative, but I think this is returned by FreeTDS, not PDO. On Mon, Oct 18, 2010 at 7:35 PM, Scott Baker bak...@canbytel.com wrote: On 10/18/2010 06:27 PM, Wez Furlong wrote: Things to check: - Environment: what env vars are set or not set in your Apache vs. CLI - Owner: are you running as the same user as your web server? - Do you or the web server have some kind of rc file that might impact how things run? Wez you're a genius. When I ran it as the same user as apache it works fine. That got me thinking that it makes a log in /tmp. Checking the log it was only writable by the apache user. A little chmod later and now my script runs perfectly under apache and cli. Thanks for helping me think outside the box. I spent all day puzzled by this, you just made my night. - Scott -- PDO Working Group Mailing List (http://pdo.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] windows 5.2.10 PHP not working with phpinfo
--- On Mon, 8/31/09, hack988 hack988 hack...@dev.htwap.com wrote: From: hack988 hack988 hack...@dev.htwap.com Subject: Re: [PHP] windows 5.2.10 PHP not working with phpinfo To: Fred Silsbee fredsils...@yahoo.com Cc: php-general@lists.php.net Date: Monday, August 31, 2009, 6:35 AM Please set log_error=on,error_reporting=E_ALL,error_log=syslog in php.ini and then,see error detail in syslog. 2009/8/31 Fred Silsbee fredsils...@yahoo.com: I got 5.3 working but found out there was no php_mssql.dll for it. Somebody (who didn;t know) said I had to return to 5.2.8 but I found no 5.2.8 so I am trying 5.2.10 _problem: under IE8: http://72.47.28.128:8080/phpinfo.php with: ?php phpinfo(); ? I get : The website cannot display the page HTTP 500 Most likely causes: •The website is under maintenance. •The website has a programming error. ___ I installed : php-5.2.10-Win32-VC6-x86.zip and put php.ini in C:\PHP and C:\PHP\ext AND C:\WINDOWS, C:\WINDOWS\system and C:\WINDOWS\system32 I installed FastCGI 1.5 ! In php.ini I put : cgi.force_redirect = 0 // for CGI extension_dir = C:\PHP\ext commented out ;doc_root = C:\inetpub\wwwroot // for IIS/PWS leaving doc_root = _ IIS 5.1 properties-configuration I added .php C:\PHP\php5ts.dll GET,HEAD,POST,DEBUG Maybe php-win.exe _ I added to the XP Prof environment path ;C:\PHP\;C:\PHP\ext\ I created an environment variable (and rebooted) PHPRC = C:\PHP;C:\PHP\ext I never found any statement of the necessity of requiring CGI The instructions ramble around -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php thanks! Weeks back I got it to work by retreating to 5.2.6 and altering permissions in admin. This alteration may open the way for 5.3 to work! __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] windows 5.2.10 PHP not working with phpinfo
Use Event Viewer and log type is :Application log 2009/9/2 Fred Silsbee fredsils...@yahoo.com: I looked high and low but no syslog I am currently working under XP Prof SP3 --- On Mon, 8/31/09, hack988 hack988 hack...@dev.htwap.com wrote: From: hack988 hack988 hack...@dev.htwap.com Subject: Re: [PHP] windows 5.2.10 PHP not working with phpinfo To: Fred Silsbee fredsils...@yahoo.com Cc: php-general@lists.php.net Date: Monday, August 31, 2009, 6:35 AM Please set log_error=on,error_reporting=E_ALL,error_log=syslog in php.ini and then,see error detail in syslog. 2009/8/31 Fred Silsbee fredsils...@yahoo.com: I got 5.3 working but found out there was no php_mssql.dll for it. Somebody (who didn;t know) said I had to return to 5.2.8 but I found no 5.2.8 so I am trying 5.2.10 _problem: under IE8: http://72.47.28.128:8080/phpinfo.php with: ?php phpinfo(); ? I get : The website cannot display the page HTTP 500 Most likely causes: •The website is under maintenance. •The website has a programming error. ___ I installed : php-5.2.10-Win32-VC6-x86.zip and put php.ini in C:\PHP and C:\PHP\ext AND C:\WINDOWS, C:\WINDOWS\system and C:\WINDOWS\system32 I installed FastCGI 1.5 ! In php.ini I put : cgi.force_redirect = 0 // for CGI extension_dir = C:\PHP\ext commented out ;doc_root = C:\inetpub\wwwroot // for IIS/PWS leaving doc_root = _ IIS 5.1 properties-configuration I added .php C:\PHP\php5ts.dll GET,HEAD,POST,DEBUG Maybe php-win.exe _ I added to the XP Prof environment path ;C:\PHP\;C:\PHP\ext\ I created an environment variable (and rebooted) PHPRC = C:\PHP;C:\PHP\ext I never found any statement of the necessity of requiring CGI The instructions ramble around -- 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] windows 5.2.10 PHP not working with phpinfo
*$ana)*$fac; $b0=($b1+$b0*$ana)*$fac; $anf=$an*$fac; $a1=$x*$a0+$anf*$a1; $b1=$x*$b0+$anf*$b1; if ($a1) { $fac=1.0/$a1; $g=$b1*$fac; if (abs(($g-$gold)/$g) EPS) { $gammcf=exp(-$x+$a*log($x)-($gln))*$g; return; } $gold=$g; } } echo a too large, ITMAX too small in routine GCF ; } function gammp($a,$x) { if ($x 0.0 || $a = 0.0) { echo Invalid arguments in routine GAMMP ; return 0.; } if ($x ($a+1.0)) { gser($gamser,$a,$x,$gln); return $gamser; } else { gcf($gammcf,$a,$x,$gln); return 1.0-$gammcf; } } function gammq($a,$x) { if ($x 0.0 || $a = 0.0) echo Invalid arguments in routine GAMMQ ; if ($x ($a+1.0)) { gser($gamser,$a,$x,$gln); return 1.0-$gamser; } else { gcf($gammcf,$a,$x,$gln); return $gammcf; } } function erfc($x) { return $x 0.0 ? 1.0+gammp(0.5,$x*$x) : gammq(0.5,$x*$x); } function erf($x) { return $x 0.0 ? -gammp(0.5,$x*$x) : gammp(0.5,$x*$x); } function myerf($argin) { return .5*(1.+erf($argin/sqrt(2.0))); } ? form action=new_black_scholes.php method=post p Black Scholes Option Price Calculator: temp website under Redhat Fedora 9 Linux: the first 5 boxes require input(try 100. 100. .12 .1 365.): /p p StockPrice (required): input type=text size=20 maxlength=40 name=StockPrice value=?php echo $StockPrice;? / /p p ExercisePrice (required): input type=text size=20 maxlength=40 name=ExercisePrice value=?php echo $ExercisePrice; ? / /p p Risk Free Rate of Interest(required): input type=text size=20 maxlength=40 name=RiskFreeRateInterest value=?php echo $RiskFreeRateInterest; ? / /p p Instantaneous Variance Rate of Stock's Return (required): input type=text size=20 maxlength=40 name=InstantaneousVarianceRateStocksReturn value=?php echo $InstantaneousVarianceRateStocksReturn; ? / /p p Time to Expiration of the Option(days) (required): input type=text size=20 maxlength=40 name=TimetoExpirationOption value=?php echo $TimetoExpirationOption; ? / /p p Values of the Call Option : input type=text size=20 maxlength=40 name=ValueCallOption VALUE=?php echo $ValueCallOption; ? / /p /p p Values of the Put option : input type=text size=20 maxlength=40 name=ValuePutOption VALUE=?php echo $ValuePutOption; ? / /p p Delta(calls): input type=text size=20 maxlength=40 name=DeltaCalls VALUE=?php echo $DeltaCalls; ? / /p p Delta(puts): input type=text size=20 maxlength=40 name=DeltaPuts VALUE=?php echo $DeltaPuts; ? / /p button type=submit name = submit value=Calculate! style=color:maroon font:18pt Courier; font-weight:bold Calculate /button button type=submit name = reset value=Demo! style=color:red font:18pt Courier; font-weight:bold Demo /button /form _results Please try the following: Open the 207.254.225.224:8080 home page, and then look for links to the information you want. Click the Refresh button, or try again later. HTTP 403.1 Forbidden: Execute Access Forbidden Internet Information Services Technical Information (for support personnel) Background: You have attempted to execute a CGI, ISAPI, or other executable program from a directory that does not allow programs to be executed. More information: Microsoft Support http://207.254.225.224:8080/handle_log_book_mssql.php yields: Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: LANDON\SQLEXPRESSLMKIII in C:\Inetpub\wwwroot\handle_log_book_mssql.php on line 8 (mssql_connect(...) Something went wrong while connecting to MSSQL (my message) ___ all these worked before trying 5.3 --- On Wed, 9/2/09, hack988 hack988 hack...@dev.htwap.com wrote: From: hack988 hack988 hack...@dev.htwap.com Subject: Re: [PHP] windows 5.2.10 PHP not working with phpinfo To: Fred Silsbee fredsils...@yahoo.com Cc: php-general@lists.php.net Date: Wednesday, September 2, 2009, 6:03 AM Use Event Viewer and log type is :Application log 2009/9/2 Fred Silsbee fredsils...@yahoo.com: I looked high and low
Re: [PHP] Re: windows 5.2.10 PHP not working with phpinfo
On Mon, 2009-08-31 at 02:11 +0200, Ralph Deffke wrote: use wamp 2 !! http://www.wampserver.com/ no easier way under windows ralph_def...@yahoo.de Fred Silsbee fredsils...@yahoo.com wrote in message news:43633.64942...@web59909.mail.ac4.yahoo.com... I got 5.3 working but found out there was no php_mssql.dll for it. Somebody (who didn;t know) said I had to return to 5.2.8 but I found no 5.2.8 so I am trying 5.2.10 _problem: under IE8: http://72.47.28.128:8080/phpinfo.php with: ?php phpinfo(); ? I get : The website cannot display the page HTTP 500 Most likely causes: .The website is under maintenance. .The website has a programming error. ___ I installed : php-5.2.10-Win32-VC6-x86.zip and put php.ini in C:\PHP and C:\PHP\ext AND C:\WINDOWS, C:\WINDOWS\system and C:\WINDOWS\system32 I installed FastCGI 1.5 ! In php.ini I put : cgi.force_redirect = 0 // for CGI extension_dir = C:\PHP\ext commented out ;doc_root = C:\inetpub\wwwroot // for IIS/PWS leaving doc_root = _ IIS 5.1 properties-configuration I added .php C:\PHP\php5ts.dll GET,HEAD,POST,DEBUG Maybe php-win.exe _ I added to the XP Prof environment path ;C:\PHP\;C:\PHP\ext\ I created an environment variable (and rebooted) PHPRC = C:\PHP;C:\PHP\ext I never found any statement of the necessity of requiring CGI The instructions ramble around I've always that EasyPHP is very easy to set up. Just click the installer, tick the checkboxes for the modules you want to install, and it's done. Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] windows 5.2.10 PHP not working with phpinfo
thanks! I am new to this science! where is syslog? XP Prof event log? --- On Mon, 8/31/09, hack988 hack988 hack...@dev.htwap.com wrote: From: hack988 hack988 hack...@dev.htwap.com Subject: Re: [PHP] windows 5.2.10 PHP not working with phpinfo To: Fred Silsbee fredsils...@yahoo.com Cc: php-general@lists.php.net Date: Monday, August 31, 2009, 6:35 AM Please set log_error=on,error_reporting=E_ALL,error_log=syslog in php.ini and then,see error detail in syslog. 2009/8/31 Fred Silsbee fredsils...@yahoo.com: I got 5.3 working but found out there was no php_mssql.dll for it. Somebody (who didn;t know) said I had to return to 5.2.8 but I found no 5.2.8 so I am trying 5.2.10 _problem: under IE8: http://72.47.28.128:8080/phpinfo.php with: ?php phpinfo(); ? I get : The website cannot display the page HTTP 500 Most likely causes: •The website is under maintenance. •The website has a programming error. ___ I installed : php-5.2.10-Win32-VC6-x86.zip and put php.ini in C:\PHP and C:\PHP\ext AND C:\WINDOWS, C:\WINDOWS\system and C:\WINDOWS\system32 I installed FastCGI 1.5 ! In php.ini I put : cgi.force_redirect = 0 // for CGI extension_dir = C:\PHP\ext commented out ;doc_root = C:\inetpub\wwwroot // for IIS/PWS leaving doc_root = _ IIS 5.1 properties-configuration I added .php C:\PHP\php5ts.dll GET,HEAD,POST,DEBUG Maybe php-win.exe _ I added to the XP Prof environment path ;C:\PHP\;C:\PHP\ext\ I created an environment variable (and rebooted) PHPRC = C:\PHP;C:\PHP\ext I never found any statement of the necessity of requiring CGI The instructions ramble around -- 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] windows 5.2.10 PHP not working with phpinfo
I looked high and low but no syslog I am currently working under XP Prof SP3 --- On Mon, 8/31/09, hack988 hack988 hack...@dev.htwap.com wrote: From: hack988 hack988 hack...@dev.htwap.com Subject: Re: [PHP] windows 5.2.10 PHP not working with phpinfo To: Fred Silsbee fredsils...@yahoo.com Cc: php-general@lists.php.net Date: Monday, August 31, 2009, 6:35 AM Please set log_error=on,error_reporting=E_ALL,error_log=syslog in php.ini and then,see error detail in syslog. 2009/8/31 Fred Silsbee fredsils...@yahoo.com: I got 5.3 working but found out there was no php_mssql.dll for it. Somebody (who didn;t know) said I had to return to 5.2.8 but I found no 5.2.8 so I am trying 5.2.10 _problem: under IE8: http://72.47.28.128:8080/phpinfo.php with: ?php phpinfo(); ? I get : The website cannot display the page HTTP 500 Most likely causes: •The website is under maintenance. •The website has a programming error. ___ I installed : php-5.2.10-Win32-VC6-x86.zip and put php.ini in C:\PHP and C:\PHP\ext AND C:\WINDOWS, C:\WINDOWS\system and C:\WINDOWS\system32 I installed FastCGI 1.5 ! In php.ini I put : cgi.force_redirect = 0 // for CGI extension_dir = C:\PHP\ext commented out ;doc_root = C:\inetpub\wwwroot // for IIS/PWS leaving doc_root = _ IIS 5.1 properties-configuration I added .php C:\PHP\php5ts.dll GET,HEAD,POST,DEBUG Maybe php-win.exe _ I added to the XP Prof environment path ;C:\PHP\;C:\PHP\ext\ I created an environment variable (and rebooted) PHPRC = C:\PHP;C:\PHP\ext I never found any statement of the necessity of requiring CGI The instructions ramble around -- 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] windows 5.2.10 PHP not working with phpinfo
Please set log_error=on,error_reporting=E_ALL,error_log=syslog in php.ini and then,see error detail in syslog. 2009/8/31 Fred Silsbee fredsils...@yahoo.com: I got 5.3 working but found out there was no php_mssql.dll for it. Somebody (who didn;t know) said I had to return to 5.2.8 but I found no 5.2.8 so I am trying 5.2.10 _problem: under IE8: http://72.47.28.128:8080/phpinfo.php with: ?php phpinfo(); ? I get : The website cannot display the page HTTP 500 Most likely causes: •The website is under maintenance. •The website has a programming error. ___ I installed : php-5.2.10-Win32-VC6-x86.zip and put php.ini in C:\PHP and C:\PHP\ext AND C:\WINDOWS, C:\WINDOWS\system and C:\WINDOWS\system32 I installed FastCGI 1.5 ! In php.ini I put : cgi.force_redirect = 0 // for CGI extension_dir = C:\PHP\ext commented out ;doc_root = C:\inetpub\wwwroot // for IIS/PWS leaving doc_root = _ IIS 5.1 properties-configuration I added .php C:\PHP\php5ts.dll GET,HEAD,POST,DEBUG Maybe php-win.exe _ I added to the XP Prof environment path ;C:\PHP\;C:\PHP\ext\ I created an environment variable (and rebooted) PHPRC = C:\PHP;C:\PHP\ext I never found any statement of the necessity of requiring CGI The instructions ramble around -- 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] windows 5.2.10 PHP not working with phpinfo
hack988 hack988 wrote: Please set log_error=on,error_reporting=E_ALL,error_log=syslog in php.ini and then,see error detail in syslog. 2009/8/31 Fred Silsbee fredsils...@yahoo.com: I got 5.3 working but found out there was no php_mssql.dll for it. Somebody (who didn;t know) said I had to return to 5.2.8 but I found no 5.2.8 so I am trying 5.2.10 _problem: under IE8: http://72.47.28.128:8080/phpinfo.php with: ?php phpinfo(); ? I get : The website cannot display the page HTTP 500 Most likely causes: ?The website is under maintenance. ?The website has a programming error. ___ I installed : php-5.2.10-Win32-VC6-x86.zip and put php.ini in C:\PHP and C:\PHP\ext AND C:\WINDOWS, C:\WINDOWS\system and C:\WINDOWS\system32 I installed FastCGI 1.5 ! In php.ini I put : cgi.force_redirect = 0 // for CGI extension_dir = C:\PHP\ext commented out ;doc_root = C:\inetpub\wwwroot // for IIS/PWS leaving doc_root = _ IIS 5.1 properties-configuration I added .php C:\PHP\php5ts.dll GET,HEAD,POST,DEBUG Maybe php-win.exe _ I added to the XP Prof environment path ;C:\PHP\;C:\PHP\ext\ I created an environment variable (and rebooted) PHPRC = C:\PHP;C:\PHP\ext I never found any statement of the necessity of requiring CGI The instructions ramble around Hmm, if there is a 500 error there should be entries in the apache error log which probably give a pointer to the problem. Cheers -- David Robley I'll pay off that customs official, said Tom dutifully. Today is Pungenday, the 24th day of Bureaucracy in the YOLD 3175. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] windows 5.2.10 PHP not working with phpinfo
I got 5.3 working but found out there was no php_mssql.dll for it. Somebody (who didn;t know) said I had to return to 5.2.8 but I found no 5.2.8 so I am trying 5.2.10 _problem: under IE8: http://72.47.28.128:8080/phpinfo.php with: ?php phpinfo(); ? I get : The website cannot display the page HTTP 500 Most likely causes: •The website is under maintenance. •The website has a programming error. ___ I installed : php-5.2.10-Win32-VC6-x86.zip and put php.ini in C:\PHP and C:\PHP\ext AND C:\WINDOWS, C:\WINDOWS\system and C:\WINDOWS\system32 I installed FastCGI 1.5 ! In php.ini I put : cgi.force_redirect = 0 // for CGI extension_dir = C:\PHP\ext commented out ;doc_root = C:\inetpub\wwwroot // for IIS/PWS leaving doc_root = _ IIS 5.1 properties-configuration I added .php C:\PHP\php5ts.dll GET,HEAD,POST,DEBUG Maybe php-win.exe _ I added to the XP Prof environment path ;C:\PHP\;C:\PHP\ext\ I created an environment variable (and rebooted) PHPRC = C:\PHP;C:\PHP\ext I never found any statement of the necessity of requiring CGI The instructions ramble around -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: windows 5.2.10 PHP not working with phpinfo
use wamp 2 !! http://www.wampserver.com/ no easier way under windows ralph_def...@yahoo.de Fred Silsbee fredsils...@yahoo.com wrote in message news:43633.64942...@web59909.mail.ac4.yahoo.com... I got 5.3 working but found out there was no php_mssql.dll for it. Somebody (who didn;t know) said I had to return to 5.2.8 but I found no 5.2.8 so I am trying 5.2.10 _problem: under IE8: http://72.47.28.128:8080/phpinfo.php with: ?php phpinfo(); ? I get : The website cannot display the page HTTP 500 Most likely causes: .The website is under maintenance. .The website has a programming error. ___ I installed : php-5.2.10-Win32-VC6-x86.zip and put php.ini in C:\PHP and C:\PHP\ext AND C:\WINDOWS, C:\WINDOWS\system and C:\WINDOWS\system32 I installed FastCGI 1.5 ! In php.ini I put : cgi.force_redirect = 0 // for CGI extension_dir = C:\PHP\ext commented out ;doc_root = C:\inetpub\wwwroot // for IIS/PWS leaving doc_root = _ IIS 5.1 properties-configuration I added .php C:\PHP\php5ts.dll GET,HEAD,POST,DEBUG Maybe php-win.exe _ I added to the XP Prof environment path ;C:\PHP\;C:\PHP\ext\ I created an environment variable (and rebooted) PHPRC = C:\PHP;C:\PHP\ext I never found any statement of the necessity of requiring CGI The instructions ramble around -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] continue working after finishing up with the http client
what options are there to do the following: 1. receive request from client (including post data) 2. do some work, update the db, prepare output for client 3. send output and finish up with the client 4. do some more work that might take considerable time, updating the db some more it would be convenient and efficient if step 4 took place within the same process as steps 1-3. but output control seems not to be sufficient: ob_flush(); flush(); sends the output but leave the client waiting for more. is there a way to close the connection as though exit; were called but without quitting the script? alternatively the script could start another process, copy over whatever data is needed and disconnect from it. but that has its overheads on the server. are the other possibilities? tia tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] continue working after finishing up with the http client
hi tom... exacly what are you trying to accomplish? is this in a web app? has the user hit the site, logged in, etc? can you provide an example of what the sequence of events are that you're trying to deal with.. thanks -Original Message- From: Tom Worster [mailto:f...@thefsb.org] Sent: Wednesday, May 27, 2009 6:27 AM To: php-general@lists.php.net Subject: [PHP] continue working after finishing up with the http client what options are there to do the following: 1. receive request from client (including post data) 2. do some work, update the db, prepare output for client 3. send output and finish up with the client 4. do some more work that might take considerable time, updating the db some more it would be convenient and efficient if step 4 took place within the same process as steps 1-3. but output control seems not to be sufficient: ob_flush(); flush(); sends the output but leave the client waiting for more. is there a way to close the connection as though exit; were called but without quitting the script? alternatively the script could start another process, copy over whatever data is needed and disconnect from it. but that has its overheads on the server. are the other possibilities? tia tom -- 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] continue working after finishing up with the http client
On 5/27/09 9:50 AM, bruce bedoug...@earthlink.net wrote: exacly what are you trying to accomplish? is this in a web app? has the user hit the site, logged in, etc? can you provide an example of what the sequence of events are that you're trying to deal with.. it is a web app. let's say for example that we're processing an ajax query. say we can normally generate and deliver the response to the client quickly but the speed depends on a cache with a relatively low miss rate. now, when we get a cache miss, imagine that generating the client response from scratch takes significantly less time than generating and inserting the new cache entry corresponding to the query. so we want to send the response to the client and then process the cache entry. without getting into whether or not this cache design makes sense, my question in this example is: what options are there for ending the http transition and then continuing on to do the cache update work? -Original Message- From: Tom Worster [mailto:f...@thefsb.org] Sent: Wednesday, May 27, 2009 6:27 AM To: php-general@lists.php.net Subject: [PHP] continue working after finishing up with the http client what options are there to do the following: 1. receive request from client (including post data) 2. do some work, update the db, prepare output for client 3. send output and finish up with the client 4. do some more work that might take considerable time, updating the db some more it would be convenient and efficient if step 4 took place within the same process as steps 1-3. but output control seems not to be sufficient: ob_flush(); flush(); sends the output but leave the client waiting for more. is there a way to close the connection as though exit; were called but without quitting the script? alternatively the script could start another process, copy over whatever data is needed and disconnect from it. but that has its overheads on the server. are the other possibilities? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] continue working after finishing up with the http client
2009/5/27 Tom Worster f...@thefsb.org: without getting into whether or not this cache design makes sense, my question in this example is: what options are there for ending the http transition and then continuing on to do the cache update work? You either continue processing then-and-there (exec(), or whatever) or you put the job in queue to be dealt with at your leisure. The queue is the better solution if you're concerned about processor load, as you can prioritise it. The exec() is simpler to implement. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] continue working after finishing up with the http client
hi tom... if i understand your state diagram/workflow process. your server repsonds to the client request, with two actions... action 1) return data to client relatively fast action 2) insert the data into your cache (or whereever) which takes time... is this correct? do you have to somehow use the 'new'/updated cache data in the future actions with the client... it might be possible for you to have a setup, where you have an external cron process, or other continually running process that does the cache insertions -Original Message- From: Tom Worster [mailto:f...@thefsb.org] Sent: Wednesday, May 27, 2009 7:14 AM To: bruce; php-general@lists.php.net Subject: Re: [PHP] continue working after finishing up with the http client On 5/27/09 9:50 AM, bruce bedoug...@earthlink.net wrote: exacly what are you trying to accomplish? is this in a web app? has the user hit the site, logged in, etc? can you provide an example of what the sequence of events are that you're trying to deal with.. it is a web app. let's say for example that we're processing an ajax query. say we can normally generate and deliver the response to the client quickly but the speed depends on a cache with a relatively low miss rate. now, when we get a cache miss, imagine that generating the client response from scratch takes significantly less time than generating and inserting the new cache entry corresponding to the query. so we want to send the response to the client and then process the cache entry. without getting into whether or not this cache design makes sense, my question in this example is: what options are there for ending the http transition and then continuing on to do the cache update work? -Original Message- From: Tom Worster [mailto:f...@thefsb.org] Sent: Wednesday, May 27, 2009 6:27 AM To: php-general@lists.php.net Subject: [PHP] continue working after finishing up with the http client what options are there to do the following: 1. receive request from client (including post data) 2. do some work, update the db, prepare output for client 3. send output and finish up with the client 4. do some more work that might take considerable time, updating the db some more it would be convenient and efficient if step 4 took place within the same process as steps 1-3. but output control seems not to be sufficient: ob_flush(); flush(); sends the output but leave the client waiting for more. is there a way to close the connection as though exit; were called but without quitting the script? alternatively the script could start another process, copy over whatever data is needed and disconnect from it. but that has its overheads on the server. are the other possibilities? -- 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] continue working after finishing up with the http client
On 5/27/09 12:35 PM, bruce bedoug...@earthlink.net wrote: hi tom... if i understand your state diagram/workflow process. your server repsonds to the client request, with two actions... action 1) return data to client relatively fast action 2) insert the data into your cache (or whereever) which takes time... is this correct? sure. but it was just an example of use of such an output and connection control technique. do you have to somehow use the 'new'/updated cache data in the future actions with the client... this was part of the example, yes. but another example could be that you process a web client's html form request, then send the client its response, close the client connection and then proceed with a whole bunch of complex logging of what was done. it might be possible for you to have a setup, where you have an external cron process, or other continually running process that does the cache insertions yes. this is one of the proposals david otton made, both of which are reasonable but do not enjoy the convenience or efficiency of doing the end work (e.g. the cache insertion) in the same process and memory space as the script that did the front work (e.g. processed the cache miss and sent the ajax response). doing the end work in a separate process comes with the overhead of serializing and communicating data to the other process. i found a web page suggesting that you can get a client to close the connection if you set ignore_user_abort(), then send Connection: close and Content-Length: #octets headers, then send the response followed by ob_flush and flush. can't say i'm in love with this. http://waynepan.com/2007/10/11/how-to-use-ignore_user_abort-to-do-process-ou t-of-band/ -Original Message- From: Tom Worster [mailto:f...@thefsb.org] Sent: Wednesday, May 27, 2009 7:14 AM To: bruce; php-general@lists.php.net Subject: Re: [PHP] continue working after finishing up with the http client On 5/27/09 9:50 AM, bruce bedoug...@earthlink.net wrote: exacly what are you trying to accomplish? is this in a web app? has the user hit the site, logged in, etc? can you provide an example of what the sequence of events are that you're trying to deal with.. it is a web app. let's say for example that we're processing an ajax query. say we can normally generate and deliver the response to the client quickly but the speed depends on a cache with a relatively low miss rate. now, when we get a cache miss, imagine that generating the client response from scratch takes significantly less time than generating and inserting the new cache entry corresponding to the query. so we want to send the response to the client and then process the cache entry. without getting into whether or not this cache design makes sense, my question in this example is: what options are there for ending the http transition and then continuing on to do the cache update work? -Original Message- From: Tom Worster [mailto:f...@thefsb.org] Sent: Wednesday, May 27, 2009 6:27 AM To: php-general@lists.php.net Subject: [PHP] continue working after finishing up with the http client what options are there to do the following: 1. receive request from client (including post data) 2. do some work, update the db, prepare output for client 3. send output and finish up with the client 4. do some more work that might take considerable time, updating the db some more it would be convenient and efficient if step 4 took place within the same process as steps 1-3. but output control seems not to be sufficient: ob_flush(); flush(); sends the output but leave the client waiting for more. is there a way to close the connection as though exit; were called but without quitting the script? alternatively the script could start another process, copy over whatever data is needed and disconnect from it. but that has its overheads on the server. are the other possibilities? -- 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] continue working after finishing up with the http client
On 5/27/09 10:33 AM, David Otton phpm...@jawbone.freeserve.co.uk wrote: 2009/5/27 Tom Worster f...@thefsb.org: without getting into whether or not this cache design makes sense, my question in this example is: what options are there for ending the http transition and then continuing on to do the cache update work? You either continue processing then-and-there (exec(), or whatever) or you put the job in queue to be dealt with at your leisure. The queue is the better solution if you're concerned about processor load, as you can prioritise it. The exec() is simpler to implement. in the absence of a tidy way to close the http connection to the client in mid-php script, i think the queue will be my better bet. if i use mysql to implement the queue then i'll have some convenient options for handling it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problems working with HTML using PHP's XML tools (placing mixed text/html into xpath-specified nodes...)
Is there a straightforward way (or, heck, any way) of placing mixed html/text content into xpath-specified nodes using any of PHP's XML tools? So far, I've tried SimpleXML and the DOM and things aren't coming out well. SimpleXML: /* $filename contains path to valid XML file, $xpathxpr contains valid XPath expression matching at least one document node, $fillval contains a mixed well-formed text/xhtml string to be pre-pended within each matching node */ $sx = simplexml_load_file($filename); $nodes = $sx-xpath($xpathxpr); foreach($nodes as $node) { $children = $node-children(); $children[0] = $fillval . $children[0]; } This only sortof works. I get $fillval appended before the original contents of each matching docment node but if I've put any markup in, it's all there as literal text (ie, a href=http://php.net;php.net/a wouldn't show up as a link, you'd see the actual markup when the document is rendered). A variation on this that I tried is creating a new SimpleXMLElement object, with the mixed text/markup string as an argument passed to the constructor, since the docs seem to indicate this is blessed. Weirdly, when I do this, it seems to actually be stripping out the markup and just giving the text. For example: $s = new SimpleXMLElement('a href=#Boo/a') echo $s; yields Boo (and echo $s-a yields nothing). This would be such a huge bug I have a hard time believing it, so I have to suspect there's a dance I'm not doing to make this work correctly. DOM XML: /* again, $filename contains path to valid XML file, $xpathxpr contains valid XPath expression matching at least one document node, $fillval contains a mixed well-formed text/xhtml string to be pre-pended within each matching node */ $domDoc = new DOMDocument(); $domDoc-loadHTML(file_get_contents($filename)); $search = new DOMXPath($domDoc); $nodes = $search-query($xpathxpr); foreach($nodes as $emt) { $f = $domDoc-createDocumentFragment(); $f-appendXML($fillval . $emt-nodeValue); $emt-nodeValue = ''; $emt-appendChild($f); } This also gets mixed results. It gets cranky and issues warnings about any HTML entities (despite that it seems it should be clear this is an HTML document given the invocation of loadHTML), and while I'm seeing some markup make it through, I'm not in other cases. I haven't quite figured out the difference. I can come up with some runnable tests if it will help, but I'm hoping someone's already familiar with the general issues with using PHP's XML tools to work with HTML that they can make some good commentary on the matter. Thanks, Weston -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems working with HTML using PHP's XML tools (placing mixed text/html into xpath-specified nodes...)
Weston C wrote: Is there a straightforward way (or, heck, any way) of placing mixed html/text content into xpath-specified nodes using any of PHP's XML tools? So far, I've tried SimpleXML and the DOM and things aren't coming out well. Not sure if it is of any use to you, I don't use XPath at all, but this php class modifies existing DOMDocument objects for filtering purposes and may give you an idea of how it is done: http://www.clfsrpm.net/xss/cspfilter_class.phps For a clearer example of adding a node to an existing document - from http://www.clfsrpm.net/xss/dom_script_test.phps That page is hard to read as it was butchered from another script, so here are the demonstrative parts: $import_prepare = 'div' . $somexmlcontentinastring . '/div'; $newDom = new DOMDocument(1.0,UTF-8); $newDom-loadXML($import_prepare); $elements = $newDom-getElementsByTagName(div); $imported_div = $elements-item(0); Now - $imported_div is an object node containing all the xml in import_prepare (you don't have to put it in a div, I did there because it's a form so I don't know the structure of xml input, putting it in a div gave me a known element that would be parent of all input) - but it is a node for the $newDom DOMDocument, I need to import it into the DOMDocument I am using. $testDiv = $myxhtml-importNode($imported_div,true); Now, $testDiv an a DOM object associated with the DOMDocument I want to import the node into. $xmlBody-appendChild($testDiv); Now the node is a child of the $xmlBody node, and has been incorporated into my DOMDocument. -=-=-=- importHTML() is problematic with some characters. Better to convert your additions to well formed xml and use importXML(); -=-=-=- While I am currently using DOMDocument for everything (yes, everything), I'm still learning it - do not consider me a guru on it's use. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Working directory of PHP pages?
On Thu, Mar 12, 2009 at 12:47 AM, Clancy clanc...@cybec.com.au wrote: On Wed, 11 Mar 2009 13:03:19 -0500, halip...@gmail.com (haliphax) wrote: On Wed, Mar 11, 2009 at 12:44 PM, Shawn McKenzie nos...@mckenzies.net wrote: Clancy wrote: It is my understanding that when you open a page the PHP server looks for index.php in the site root directory, and loads it. As a result the working directory of the page will be the root directory of the site. I have always worked on this assumption, and it has always been correct. On the other hand Stewart thinks that I cannot rely this, and am likely to get into trouble as a result. Are there any systems in which my assumption will not be correct? In many frameworks this assumption is not correct. I am using the default CakePHP layout as an example. Depending on your terminology, your DocumentRoot is /var/www/ and in this case is also the filesystem path of your site's root dir, however the sites root dir in a URL is /. Consider the CakePHP structure: /var/www/ .htaccess index.php /var/www/webroot index.php If you browse to http://example.com/ (in most cases), one of 2 things happens: 1. The webserver opens the /var/www/.htaccess and according to the rewrite rules there it rewrites to /var/www/webroot/. So any getcwd() would be /var/www/webroot/ 2. If not using modrewrite, the web server looks for index.html and then index.php in /var/www/ which has a require for webroot/index.php. So any getcwd() would be /var/www/. Consequently, CakePHP and the other frameworks that I've seen use basename() and dirname() in conjunction with __FILE__ to define the paths/relative dirs within the app. Come to think of it, this may very well be true for all MVC frameworks (unless the models, views, and controllers are all in the same directory as the launch script). I can at least vouch for the fact that CodeIgniter, like CakePHP, will fudge your directory estimation if you're expecting getcwd() to be right. Something Stewart said the other day made me realise that there was a fundamental error in the way I was thinking about this question. I had been thinking that opendir (.) opened the root directory, and that paths such as Joe/Nurg.com were relative to the root directory, but I now realise that they are relative to the current directory, whatever that might be. (Yes; I should have known better, but there is an awful swamp of burnt out brain cells at the bottom of my brain.) So the question I should have asked was When a web page is loaded, can I rely on the CWD being the directory containing index.php (or whichever file is actually loaded)? I believe the answer was No, not really, from several different people. -- // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Working directory of PHP pages?
Clancy wrote: It is my understanding that when you open a page the PHP server looks for index.php in the site root directory, and loads it. As a result the working directory of the page will be the root directory of the site. I have always worked on this assumption, and it has always been correct. On the other hand Stewart thinks that I cannot rely this, and am likely to get into trouble as a result. Are there any systems in which my assumption will not be correct? In many frameworks this assumption is not correct. I am using the default CakePHP layout as an example. Depending on your terminology, your DocumentRoot is /var/www/ and in this case is also the filesystem path of your site's root dir, however the sites root dir in a URL is /. Consider the CakePHP structure: /var/www/ .htaccess index.php /var/www/webroot index.php If you browse to http://example.com/ (in most cases), one of 2 things happens: 1. The webserver opens the /var/www/.htaccess and according to the rewrite rules there it rewrites to /var/www/webroot/. So any getcwd() would be /var/www/webroot/ 2. If not using modrewrite, the web server looks for index.html and then index.php in /var/www/ which has a require for webroot/index.php. So any getcwd() would be /var/www/. Consequently, CakePHP and the other frameworks that I've seen use basename() and dirname() in conjunction with __FILE__ to define the paths/relative dirs within the app. -- Thanks! -Shawn http://www.spidean.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Working directory of PHP pages?
On Wed, Mar 11, 2009 at 12:44 PM, Shawn McKenzie nos...@mckenzies.net wrote: Clancy wrote: It is my understanding that when you open a page the PHP server looks for index.php in the site root directory, and loads it. As a result the working directory of the page will be the root directory of the site. I have always worked on this assumption, and it has always been correct. On the other hand Stewart thinks that I cannot rely this, and am likely to get into trouble as a result. Are there any systems in which my assumption will not be correct? In many frameworks this assumption is not correct. I am using the default CakePHP layout as an example. Depending on your terminology, your DocumentRoot is /var/www/ and in this case is also the filesystem path of your site's root dir, however the sites root dir in a URL is /. Consider the CakePHP structure: /var/www/ .htaccess index.php /var/www/webroot index.php If you browse to http://example.com/ (in most cases), one of 2 things happens: 1. The webserver opens the /var/www/.htaccess and according to the rewrite rules there it rewrites to /var/www/webroot/. So any getcwd() would be /var/www/webroot/ 2. If not using modrewrite, the web server looks for index.html and then index.php in /var/www/ which has a require for webroot/index.php. So any getcwd() would be /var/www/. Consequently, CakePHP and the other frameworks that I've seen use basename() and dirname() in conjunction with __FILE__ to define the paths/relative dirs within the app. Come to think of it, this may very well be true for all MVC frameworks (unless the models, views, and controllers are all in the same directory as the launch script). I can at least vouch for the fact that CodeIgniter, like CakePHP, will fudge your directory estimation if you're expecting getcwd() to be right. -- // Todd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Working directory of PHP pages?
On Wed, 11 Mar 2009 13:03:19 -0500, halip...@gmail.com (haliphax) wrote: On Wed, Mar 11, 2009 at 12:44 PM, Shawn McKenzie nos...@mckenzies.net wrote: Clancy wrote: It is my understanding that when you open a page the PHP server looks for index.php in the site root directory, and loads it. As a result the working directory of the page will be the root directory of the site. I have always worked on this assumption, and it has always been correct. On the other hand Stewart thinks that I cannot rely this, and am likely to get into trouble as a result. Are there any systems in which my assumption will not be correct? In many frameworks this assumption is not correct. I am using the default CakePHP layout as an example. Depending on your terminology, your DocumentRoot is /var/www/ and in this case is also the filesystem path of your site's root dir, however the sites root dir in a URL is /. Consider the CakePHP structure: /var/www/ .htaccess index.php /var/www/webroot index.php If you browse to http://example.com/ (in most cases), one of 2 things happens: 1. The webserver opens the /var/www/.htaccess and according to the rewrite rules there it rewrites to /var/www/webroot/. So any getcwd() would be /var/www/webroot/ 2. If not using modrewrite, the web server looks for index.html and then index.php in /var/www/ which has a require for webroot/index.php. So any getcwd() would be /var/www/. Consequently, CakePHP and the other frameworks that I've seen use basename() and dirname() in conjunction with __FILE__ to define the paths/relative dirs within the app. Come to think of it, this may very well be true for all MVC frameworks (unless the models, views, and controllers are all in the same directory as the launch script). I can at least vouch for the fact that CodeIgniter, like CakePHP, will fudge your directory estimation if you're expecting getcwd() to be right. Something Stewart said the other day made me realise that there was a fundamental error in the way I was thinking about this question. I had been thinking that opendir (.) opened the root directory, and that paths such as Joe/Nurg.com were relative to the root directory, but I now realise that they are relative to the current directory, whatever that might be. (Yes; I should have known better, but there is an awful swamp of burnt out brain cells at the bottom of my brain.) So the question I should have asked was When a web page is loaded, can I rely on the CWD being the directory containing index.php (or whichever file is actually loaded)? Thank you all for your assistance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Working directory of PHP pages?
On Thu, Mar 12, 2009 at 11:47 AM, Clancy clanc...@cybec.com.au wrote: Something Stewart said the other day made me realise that there was a fundamental error in the way I was thinking about this question. I had been thinking that opendir (.) opened the root directory, and that paths such as Joe/Nurg.com were relative to the root directory, but I now realise that they are relative to the current directory, whatever that might be. (Yes; I should have known better, but there is an awful swamp of burnt out brain cells at the bottom of my brain.) a dot (.) denotes a current directory and double dot (..) denotes parent directory of the current in DOS/Windows/*nix File System. So the question I should have asked was When a web page is loaded, can I rely on the CWD being the directory containing index.php (or whichever file is actually loaded)? Thank you all for your assistance.
Re: [PHP] Last working day of a month
On Thu, Dec 4, 2008 at 9:03 AM, Angelo Zanetti [EMAIL PROTECTED] wrote: Hi all, I am busy trying to figure out how to get the last working day in a month. I was wondering if there was a script already written, but this is what I imagine should work: Get the current day and see if it's the last day of the month. If its true check if it's a Saturday or Sunday if it's either of those 2 days then return false else return true? I also need to take public holidays into account. What would be the best solution for that? Store the public holidays in a table and check if the current day isn't a public holiday? Any advice is appreciated. TIA Angelo If your application is already using a database, I would use a date table rather than a holiday table. You can add columns to indicate whether each date is a workday, weekday, weekend, holiday, or any other date category/group that you need to track. Andrew -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Last working day of a month
Hi all, I am busy trying to figure out how to get the last working day in a month. I was wondering if there was a script already written, but this is what I imagine should work: Get the current day and see if it's the last day of the month. If its true check if it's a Saturday or Sunday if it's either of those 2 days then return false else return true? I also need to take public holidays into account. What would be the best solution for that? Store the public holidays in a table and check if the current day isn't a public holiday? Any advice is appreciated. TIA Angelo Web: http://www.elemental.co.za -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Last working day of a month
-Original Message- From: Andrew Ballard [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2008 8:32 AM To: Angelo Zanetti Cc: php-general@lists.php.net Subject: Re: [PHP] Last working day of a month Importance: Low On Thu, Dec 4, 2008 at 9:03 AM, Angelo Zanetti [EMAIL PROTECTED] wrote: Hi all, I am busy trying to figure out how to get the last working day in a month. I was wondering if there was a script already written, but this is what I imagine should work: Get the current day and see if it's the last day of the month. If its true check if it's a Saturday or Sunday if it's either of those 2 days then return false else return true? I also need to take public holidays into account. What would be the best solution for that? Store the public holidays in a table and check if the current day isn't a public holiday? If your application is already using a database, I would use a date table rather than a holiday table. You can add columns to indicate whether each date is a workday, weekday, weekend, holiday, or any other date category/group that you need to track. That seems like a waste of space and database calls to me. (Yes, I know space is cheap... but it should at least be thought about briefly. Using that space costs cycles, etc.) Since the exceptions to his rule are so few in comparison to the days that follow, I think documenting the exceptions and assuming it's a workday if it's not an exception makes more sense (IMHO). I'd probably store all holidays in a table and assume that Saturdays/Sundays are not workdays unless they have a corresponding entry in the same table that holds the holidays. Call the table exceptions. The exception to a workday is a holiday. The exception to a weekend is a workday. :) HTH, // Todd
Re: [PHP] Last working day of a month
Angelo Zanetti schreef: Hi all, I am busy trying to figure out how to get the last working day in a month. I was wondering if there was a script already written, but this is what I imagine should work: Get the current day and see if it's the last day of the month. If its true check if it's a Saturday or Sunday if it's either of those 2 days then return false else return true? I also need to take public holidays into account. What would be the best solution for that? Store the public holidays in a table and check if the current day isn't a public holiday? you need a process with a few simple steps. 1. find the last day of the month, this is quite easy ... google gives answers as does the manual. e.g.: http://lutrov.com/blog/php-last-day-of-the-month-calculation/ 2. determine if this is a week day. if yes go to step three else 'roll the date back' 24 hours and go to step 2. 3. determine if this is a holiday, if yes 'roll the date back' 24 hours and go to step 2. else you have found the last working day of the month. with regard to determining if a day is a holiday your best bet is to store these in a database table. and check against that ... you may be able to find a source of holiday data online from which you can sync your local datasource periodically (e.g. via a cron job). hth Any advice is appreciated. TIA Angelo Web: http://www.elemental.co.za -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Last working day of a month
you need a process with a few simple steps. 1. find the last day of the month, this is quite easy ... google gives answers as does the manual. e.g.: http://lutrov.com/blog/php-last-day-of-the-month-calculation/ 2. determine if this is a week day. if yes go to step three else 'roll the date back' 24 hours and go to step 2. 3. determine if this is a holiday, if yes 'roll the date back' 24 hours and go to step 2. else you have found the last working day of the month. with regard to determining if a day is a holiday your best bet is to store these in a database table. and check against that ... you may be able to find a source of holiday data online from which you can sync your local datasource periodically (e.g. via a cron job). hth Well it should!! The advice I love most of all is like this, helping me see the clear logic, and then letting me figure out how to write it w/the language at hand. This reply post of mine does not add anything for anyone; sometimes I just can't help express my appreciation for things. Brilliant Jochem! -G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] send emails in php not working
We recently moved to a new server. Our code that would send out emails is no longer sending emails. There are no messages in the httpd logs associated with running the email.php files. The email scripts worked on the old server. Is there a special setting in php.ini for sending emails in php or is there a packages that needs to be installed on the new server. Below is some sample code that worked on the old server Receive the email request: 1 html 2 body 3 4 form action=emailFormProcess.php method=post 5 Your Name: input type=text name=namebr 6 E-mail: input type=text name = emailbrbr 7 Commentsbr 8 textarea name=comments/textareabrbr 9 input type=submit value=Submit 10 /form 11 12 /body 13 /html Process the email request: 1 html 2 body 3 4 ? 5 function checkOK($field) 6 { 7 if (eregi(\r,$field) || eregi(\n,$field)){ 8 die(Invalid Input!); 9 } 10 } 11 12 $name=$_POST['name']; 13 checkOK($name); 14 $email=$_POST['email']; 15 checkOK($email); 16 $comments=$_POST['comments']; 17 checkOK($comments); 18 $to=[EMAIL PROTECTED],$email; 19 $message=$name just filled in your comments form. They said:\n$comments\n\nTheir e-mail address iss: $email; 20 if(mail($to,Comments From Your Site,$message,From: $email\n)) { 21 echo Thanks for your comments.; 22 } else { 23 echo There was a problem sending the mail. Please check that you filled in the form correctly.; 24 } 25 ? 26 27 /html 28 /body Thanks Marc
Re: [PHP] send emails in php not working
Marc Fromm wrote: We recently moved to a new server. Our code that would send out emails is no longer sending emails. There are no messages in the httpd logs associated with running the email.php files. The email scripts worked on the old server. Is there a special setting in php.ini for sending emails in php or is there a packages that needs to be installed on the new server. Below is some sample code that worked on the old server You need a local mail server. Choices usually are postfix, exim, sendmail or qmail (I suggest postfix) - they are usually the top 4 open source ones. Does email work from command line? echo 'test' | mail -s 'test' [EMAIL PROTECTED] -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] send emails in php not working
You need a local mail server. Sendmail 8.13.8-2.el5 is installed on the new server and the old server (sendmail-8.13.8-1.fc5). echo 'test' | mail -s 'test' [EMAIL PROTECTED] The above line sends on email on the old server but not the new server. -Original Message- From: Chris [mailto:[EMAIL PROTECTED] Sent: Monday, October 27, 2008 2:55 PM To: Marc Fromm Cc: php-general@lists.php.net Subject: Re: [PHP] send emails in php not working Marc Fromm wrote: We recently moved to a new server. Our code that would send out emails is no longer sending emails. There are no messages in the httpd logs associated with running the email.php files. The email scripts worked on the old server. Is there a special setting in php.ini for sending emails in php or is there a packages that needs to be installed on the new server. Below is some sample code that worked on the old server You need a local mail server. Choices usually are postfix, exim, sendmail or qmail (I suggest postfix) - they are usually the top 4 open source ones. Does email work from command line? echo 'test' | mail -s 'test' [EMAIL PROTECTED] -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] send emails in php not working
Marc Fromm wrote: You need a local mail server. Sendmail 8.13.8-2.el5 is installed on the new server and the old server (sendmail-8.13.8-1.fc5). echo 'test' | mail -s 'test' [EMAIL PROTECTED] The above line sends on email on the old server but not the new server. Is sendmail running (ps -ef | grep sendmail)? Anything in /var/log/mail.log or where-ever sendmail puts it's logs? It could also be set to queue only and send everything in one bunch instead of as it gets emails. I don't know sendmail to tell you how to check that. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Working with XML: DomDocument or SimpleXML?
Colin Guthrie wrote: snip / I know I definitely want to do XSLT stuff and for that I need to use DomDocument (I'm sure there are other ways but this works fine for me so far!). Fairly unknown tidbit: you can pass SimpleXML objects to the XSL extension. XSL will use the document from it. snip / I'll phrase it better: one can easily convert a SimpleXML object to a DomDocument[1], but nothing is free (in terms of time taken and memory requirements etc.), so really I guess I want to ask if the trade off of the simplicity of working with SimpleXML is worth it considering the overhead of the conversion process to a DomDocument for subsequent XSLT transforms etc? Conversion is easy and the time/memory is negligible due to how the interoperability was designed. The whole purpose of it is so you can go back and forth to use whichever API suits you need at the time. if ($xml instanceof SimpleXMLElement) { $rv = new DOMDocument('1.0', 'utf-8'); $node = dom_import_simplexml($xml); $node = $rv-importNode($node, true); $rv-appendChild($node); return $rv; } Why??? If you really want a DOMDocument object why are you creating a new document, copying nodes and incurring all the additional overhead? if ($xml instanceof SimpleXMLElement) { /* No copying, just use the existing XML tree directly */ $node = dom_import_simplexml($xml); return $node-ownerDocument; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Working with XML: DomDocument or SimpleXML?
Rob wrote: Fairly unknown tidbit: you can pass SimpleXML objects to the XSL extension. XSL will use the document from it. Nice to know... /me will have to experiment! if ($xml instanceof SimpleXMLElement) { $rv = new DOMDocument('1.0', 'utf-8'); $node = dom_import_simplexml($xml); $node = $rv-importNode($node, true); $rv-appendChild($node); return $rv; } Why??? If you really want a DOMDocument object why are you creating a new document, copying nodes and incurring all the additional overhead? if ($xml instanceof SimpleXMLElement) { /* No copying, just use the existing XML tree directly */ $node = dom_import_simplexml($xml); return $node-ownerDocument; } Yeah I had that initially too but that did not produce a DOMDocument Object but a DOMNode Object (or something like that will have to test again as memory is corrupted - there /was/ a reason, and stupid me didn't comment the code.). Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Working with XML: DomDocument or SimpleXML?
Rob wrote: It had to have been for some other reason as the return type for the above example is a DOMDocument. A raw DOMNode is *NEVER* returned from the DOM extension. It is simply a base class for most of the DOM classes, such as DOMDocument. I think I just didn't do the -ownerDocument or something daft like that in the past. This is great (still need to test but I trust you!) as it means we can work happily with either model quite happily (for two reasons if you can just pass the SimpleXML object straight into the XSLT stuff!!) Cheers Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Working with XML: DomDocument or SimpleXML?
Colin Guthrie wrote: Rob wrote: if ($xml instanceof SimpleXMLElement) { /* No copying, just use the existing XML tree directly */ $node = dom_import_simplexml($xml); return $node-ownerDocument; } Yeah I had that initially too but that did not produce a DOMDocument Object but a DOMNode Object (or something like that will have to test again as memory is corrupted - there /was/ a reason, and stupid me didn't comment the code.). It had to have been for some other reason as the return type for the above example is a DOMDocument. A raw DOMNode is *NEVER* returned from the DOM extension. It is simply a base class for most of the DOM classes, such as DOMDocument. Rob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Working with XML: DomDocument or SimpleXML?
Robert Cummings wrote: I still use PHP4 so I wrote my own XML handling class that wraps the xml_xxx() series of functions. Haven't had a problem with it. Makes working with XML very easy since it uses a path string syntax to focus/access nodes and attributes: Cheers for that. I know I definitely want to do XSLT stuff and for that I need to use DomDocument (I'm sure there are other ways but this works fine for me so far!). I guess think I asked too open a question, when really I'm looking for fairly specific answers (or rather opinions). I'll phrase it better: one can easily convert a SimpleXML object to a DomDocument[1], but nothing is free (in terms of time taken and memory requirements etc.), so really I guess I want to ask if the trade off of the simplicity of working with SimpleXML is worth it considering the overhead of the conversion process to a DomDocument for subsequent XSLT transforms etc? Col [1] e.g. if ($xml instanceof SimpleXMLElement) { $rv = new DOMDocument('1.0', 'utf-8'); $node = dom_import_simplexml($xml); $node = $rv-importNode($node, true); $rv-appendChild($node); return $rv; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php not working anymore in IIS
After changing my php folder from e:\php to f:\php php does not work anymore in my webserver. I found out regsvr32 phpisapi.dll gives an error. I remember having a similar problem but am not sure what and how. Anyone know how to fix? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP not working after Mac 10.3.9 install
Greetings, I am a very novice user of PHP. I have run PHP 4 on my Powerbook for about three years. When I installed Mac OS 10.3.9, PHP does not work. I forgot how to get it running again. Can anyone help me with this? Thanks, -- Steve Marquez
[PHP] Re: [SPAM] Re: [PHP] Attempting to search a MySQL database from PHP not working
On May 31, 2007, at 5:43 PM, Richard Lynch wrote: On Thu, May 31, 2007 2:25 pm, Jason Pruim wrote: Hi Everyone, I am attempting to setup a search field on a database application I'm dinking around with and running into problems that I'm hoping someone might be able to shed some light on. Here is the code I am using to display the results of the search: echo ('table border=1'); echo trthFirst Name/ththAuthor/ththPages/th/tr; $result_row[] = mysql_query($query) or die(mysql_error()); I also have to wonder why you are building an array of query result resources... You probably could do this with just one SQL query and some order by clauses to get what you want, without hitting the DB so much. To use the newbie scape goat, I don't know how else to do it, and it seems to work :) What would you recommend? I am always open to find ways to make my code better/faster/more secure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Attempting to search a MySQL database from PHP not working
Hi Everyone, I am attempting to setup a search field on a database application I'm dinking around with and running into problems that I'm hoping someone might be able to shed some light on. Here is the code I am using to display the results of the search: echo ('table border=1'); echo trthFirst Name/ththAuthor/ththPages/th/tr; $result_row[] = mysql_query($query) or die(mysql_error()); echo Result_row dump: $result_row BR; $num=mysql_numrows($result); echo Num dump: $num BR; $i= 0; while($i $num) { echo trtd; echo $result_row[0] . '/tdtd'; echo $result_row[1] . '/tdtd'; echo $result_row[2] . '/td/tr'; $i++; } echo (/table); the problem is instead of printing out the actual results it prints out 6 fields that say: Resource id #5 the query I'm using is: SELECT FName, LName, Add1, Add2 FROM current WHERE FName like '%jason%' which works in MySQL I can't find any errors in my log files to even give me a hint as to what is going on. If someone could take a look I would greatly appreciate it. Jason Pruim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Attempting to search a MySQL database from PHP not working
Em Quinta 31 Maio 2007 16:25, Jason Pruim escreveu: Hi Everyone, I am attempting to setup a search field on a database application I'm dinking around with and running into problems that I'm hoping someone might be able to shed some light on. Here is the code I am using to display the results of the search: echo ('table border=1'); echo trthFirst Name/ththAuthor/ththPages/th/tr; $result_row[] = mysql_query($query) or die(mysql_error()); echo Result_row dump: $result_row BR; $num=mysql_numrows($result); echo Num dump: $num BR; $i= 0; /* while($i $num) { */ $result=$result_row[0]; while($result_row = mysql_fetch_array($result) { echo trtd; echo $result_row[0] . '/tdtd'; echo $result_row[1] . '/tdtd'; echo $result_row[2] . '/td/tr'; $i++; } echo (/table); the problem is instead of printing out the actual results it prints out 6 fields that say: Resource id #5 the query I'm using is: SELECT FName, LName, Add1, Add2 FROM current WHERE FName like '%jason%' which works in MySQL I can't find any errors in my log files to even give me a hint as to what is going on. If someone could take a look I would greatly appreciate it. HTH -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Religion, ideology, resources, land, spite, love or just because... No matter how pathetic the reason, it's enough to start a war. Por favor não faça top-posting, coloque a sua resposta abaixo desta linha. Please don't do top-posting, put your reply below the following line. pgpoZaZKvtBnT.pgp Description: PGP signature
Re: [PHP] Attempting to search a MySQL database from PHP not working
On Thu, 2007-05-31 at 15:25 -0400, Jason Pruim wrote: Hi Everyone, I am attempting to setup a search field on a database application I'm dinking around with and running into problems that I'm hoping someone might be able to shed some light on. Here is the code I am using to display the results of the search: echo ('table border=1'); echo trthFirst Name/ththAuthor/ththPages/th/tr; $result_row[] = mysql_query($query) or die(mysql_error()); mysql_query() doesn't return the rows. Go read the manual. 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] Attempting to search a MySQL database from PHP not working
Your problem is this: $result_row[] = mysql_query($query) or die(mysql_error()); ...you are assigning a query to a variable. What you need to do is something like this: $result = mysql_query($query) or die(mysql_error()); while ($result_row = mysql_fetch_array($result)) { . }
Re: [PHP] Attempting to search a MySQL database from PHP not working
On May 31, 2007, at 3:27 PM, Davi wrote: Em Quinta 31 Maio 2007 16:25, Jason Pruim escreveu: Hi Everyone, I am attempting to setup a search field on a database application I'm dinking around with and running into problems that I'm hoping someone might be able to shed some light on. Here is the code I am using to display the results of the search: echo ('table border=1'); echo trthFirst Name/ththAuthor/ththPages/th/tr; $result_row[] = mysql_query($query) or die(mysql_error()); echo Result_row dump: $result_row BR; $num=mysql_numrows($result); echo Num dump: $num BR; $i= 0; /* while($i $num) { */ $result=$result_row[0]; while($result_row = mysql_fetch_array($result) { Worked perfectly after adding a closing ) Thanks for the tip! echo trtd; echo $result_row[0] . '/tdtd'; echo $result_row[1] . '/tdtd'; echo $result_row[2] . '/td/tr'; $i++; } echo (/table); the problem is instead of printing out the actual results it prints out 6 fields that say: Resource id #5 the query I'm using is: SELECT FName, LName, Add1, Add2 FROM current WHERE FName like '%jason%' which works in MySQL I can't find any errors in my log files to even give me a hint as to what is going on. If someone could take a look I would greatly appreciate it. HTH -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Religion, ideology, resources, land, spite, love or just because... No matter how pathetic the reason, it's enough to start a war. Por favor não faça top-posting, coloque a sua resposta abaixo desta linha. Please don't do top-posting, put your reply below the following line. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Attempting to search a MySQL database from PHP not working
Em Quinta 31 Maio 2007 16:38, Jason Pruim escreveu: while($result_row = mysql_fetch_array($result) { Worked perfectly after adding a closing ) Thanks for the tip! Forgive me for that!!! #'_'# I *always* forget the closing )... =P -- Davi Vidal [EMAIL PROTECTED] [EMAIL PROTECTED] -- Religion, ideology, resources, land, spite, love or just because... No matter how pathetic the reason, it's enough to start a war. Por favor não faça top-posting, coloque a sua resposta abaixo desta linha. Please don't do top-posting, put your reply below the following line. pgpH2cHUfJswa.pgp Description: PGP signature
Re: [PHP] Attempting to search a MySQL database from PHP not working
On Thu, May 31, 2007 2:25 pm, Jason Pruim wrote: Hi Everyone, I am attempting to setup a search field on a database application I'm dinking around with and running into problems that I'm hoping someone might be able to shed some light on. Here is the code I am using to display the results of the search: echo ('table border=1'); echo trthFirst Name/ththAuthor/ththPages/th/tr; $result_row[] = mysql_query($query) or die(mysql_error()); I also have to wonder why you are building an array of query result resources... You probably could do this with just one SQL query and some order by clauses to get what you want, without hitting the DB so much. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: working with class inheritance
OOPS!... typo Please replace implements with extends: class Child extends Parent Sorry about that Jeff Taylor [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hey all, got a slight problem, where for some reasons my variables dont seem to be getting stored in the child class: e.g class Parent { $private type; public function __construct() { } public function GetType() { return $this-type; } } class Child implements Parent { $public function __construct() $this-type= 'Child'; } } $Child= new Child(); echo $Child-getType; Can u see any reason why the type would return null? Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: working with class inheritance
I forgot to mention that I have some __construct operations in the parent class, and I want to add to those (and overwrite sometimes) in the child class __construct i.e Parent class __construct $this-foo = 'Bar'; $this-foo2 = '10'; Child class __construct $this-foo.='Bar'; $this-foo2 .= rand(1,6); $this-type = 'Child'; Outputs of variables foo == Bar Bar foo2 == 11-16 type == Child Thanks :) Jeff Taylor [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] OOPS!... typo Please replace implements with extends: class Child extends Parent Sorry about that Jeff Taylor [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hey all, got a slight problem, where for some reasons my variables dont seem to be getting stored in the child class: e.g class Parent { $private type; public function __construct() { } public function GetType() { return $this-type; } } class Child implements Parent { $public function __construct() $this-type= 'Child'; } } $Child= new Child(); echo $Child-getType; Can u see any reason why the type would return null? Thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: working with class inheritance
# [EMAIL PROTECTED] / 2007-03-20 19:14:17 +1030: Jeff Taylor [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hey all, got a slight problem, where for some reasons my variables dont seem to be getting stored in the child class: e.g class Parent { $private type; public function __construct() { } public function GetType() { return $this-type; } } class Child implements Parent { $public function __construct() $this-type= 'Child'; } } $Child= new Child(); echo $Child-getType; Can u see any reason why the type would return null? OOPS!... typo Please replace implements with extends: class Child extends Parent The code you posted doesn't parse either way, next time please post the real thing. There's several problems in the code as posted, and either could cause your problem. You're probably looking for this: class parent { public function __construct() {} private $type; protected function settype($type) { $this-type = $type; } public function gettype() { return $this-type; } } class child { public function __construct() { $this-settype('Child'); } } If all instances of parent subclasses must have a type assigned for their whole lifetime it's better to have parent require it, and not provide its descendants a way to change the type during their life: class parent { protected function __construct($type) { $this-type = $type; } private $type; public function gettype() { return $this-type; } } class child { public function __construct() { parent::__construct('Child'); } } -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: working with class inheritance
Jeff Taylor wrote: Hey all, got a slight problem, where for some reasons my variables dont seem to be getting stored in the child class: e.g class Parent { $private type; public function __construct() { } public function GetType() { return $this-type; } } class Child implements Parent { $public function __construct() $this-type= 'Child'; } } $Child= new Child(); echo $Child-getType; Can u see any reason why the type would return null? Hi Jeff, Aside from your obvious parse errors, the main problem is that you are incorrectly using private. Since you wish to access $type from the child class, you must use protected or declare a setter function as Roman suggested. However, setter functions are far less efficient than simply using protected: ?php class whatever { protected $type = 'whatever'; } class Child extends whatever { public function __construct() {$this-type='Child';} } ? It should be noted that if you simply want to store the class name, a better approach is to use get_class() ?php class whatever {} class child {} $a = new whatever; $b = new child; echo get_class($a), ' ', get_class($b); ? Of course, you may want to remove a prefix from the classname, in which case you could also use a simple __get()/__set() declaration that prevents accidental modification of object type: ?php class prefix_myclass { function __get($var) { if ($var == 'type') return str_replace('prefix_', '', get_class($this)); } function __set($var, $value) { if ($var == 'type') return; // ignore } } class prefix_child extends prefix_myclass {} $a = new prefix_myclass; $b = new prefix_child; echo $a-type , ' ' , $b-type; $a-type = 5; echo $a-type , ' ' , $b-type; ? Regards, Greg -- Experience the revolution, buy the PEAR Installer Manifesto http://www.packtpub.com/book/PEAR-installer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sessions working/not
Hey - -- - Would anyone be so kind as to un-stick my brain? I can't get sessions to work on my development machine (localhost). They work fine on my testing server (an internal IP). Development: W2K, Testing Server W2K Server, both using IIS 5, PHP 5.2. The php.ini SESSION settings are the same on both machines. Seems to me I made this choice at some point, but now my feeble brain can't bring it up. bueller Anyone? Anyone? /bueller Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Working with a config file
Benjamin Adams wrote: I'm trying to parse a config file, example of the config is: [fred] id=8782 section=s1 years=4 download1=mirror1 [frank] id=8372 section=s3 years=4 download1=mirror12 download2=mirror2 . . . I want to parse this so I can only call frank or freds data and move id, section, years, etc to varaibles. Can someone give me some help Thanks Ben --PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php If you´ve a php 5 environment I would recommend the Configuration Package of the newly releases ezComponents. Components overview: http://ez.no/doc/components/overview Fast, feature-rich and easy to use, hava a look at the tutorial: http://ez.no/doc/components/view/(file)/1.0/introduction_Configuration.html -Jens -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Working with a config file
On Tue, 2006-02-21 at 00:14 +0100, Jens Kleikamp wrote: Benjamin Adams wrote: I'm trying to parse a config file, example of the config is: [fred] id=8782 section=s1 years=4 download1=mirror1 [frank] id=8372 section=s3 years=4 download1=mirror12 download2=mirror2 . Config files of this type in PHP anyway, are generally generated by the PEAR Config package. Luckily for you it works both ways (creating and reading the files) so its really easy to work with. The Config package also supports all sorts of nifty features that will make your life easier working with this file. HTH --Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Anyone working with UPS Online Tools?
Hello, I am in the process of integrating my site with UPS' Online Tools. Specifically Address Validation, and Rates and Service. The problem I'm seeing is that it's quite slow. I'm doing all my tests on the test server and thought that querying the test server would be the reason for the slowness, but when I tried the live server (once) it seemed to be the same. The test page takes about 4-6 seconds to complete. Is this a normal time for such a process? Thanks, Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Working with 3 arrays
Robert Sossomon wrote: I need to work with 3 different arrays where I get the value of the same key for all 3 (probably a term for this one). The three arrays are: field[] type[] char[] and each will be assigned via another form. What will happen is at the end of the form I want to be able to pull field[0] type[0] char[0] process the data and then move to the next one in all three. I am thinking $fields = $_POST[field]; foreach ($fields as $field) { Do the stuff } But I am a bit perplexed on how to operate on all three. Thanks, Robert $fields = $_POST[field]; foreach ($fields as $field) { $currentType = next($type); $currentChar = next($char); // Do the stuff } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Working with 3 arrays
!--SNIP -- $fields = $_POST[field]; foreach ($fields as $field) { $currentType = next($type); $currentChar = next($char); // Do the stuff } Thanks!! I knew I was missing something simple in doing this! Robert -- Robert Sossomon, Business and Technology Application Technician 4-H Youth Development Department 200 Ricks Hall, Campus Box 7606 N.C. State University Raleigh NC 27695-7606 Phone: 919/515-8474 Fax: 919/515-7812 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Offline working
Because of the problems working with the email version of the php lists, I'm forced to use the newgroup interface. Up until recently I could happily get up in the morning and 'Download Now' in Mozilla so I can scan messages quickly locally. Since xmas the 'Download Now' simply gets the first message and then times out. It's working fine on Eclipse and Borland so it's not my end, but now the only way to get the messages is one at a time. Is this something that has been changed at www.php.net? Can anything be done about it? Why should offline working be such a problem? -- Lester Caine - L.S.Caine Electronic Services -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Working With Excel File ?
With excel, export your exel file to CSV (by doing save as...) then you can import your CSV file to mysql using the phpmyadmin import interface On Tuesday 02 November 2004 04:11 am, Sejati Opreker wrote: Yes, I'm planning to work with MySQL, but the problem accour from the first time, 'cause the source is in Excel file, is MySQL able to read the CVS format ?, and can you please show me some PHP script that make outputs the contents of report to a CSV from MySQL ? --- Ben Ramsey [EMAIL PROTECTED] wrote: Matt M. wrote: Can PHP work with Excel files as database ? If not, how can I conver it to MySQL format and reconvert it to Excel 'coz I need it to report it in Excel format, if you are on windows you could use a com object. if you have access to perl, you could use http://search.cpan.org/~kwitknr/Spreadsheet-ParseExcel-0.2603/ParseExcel.pm You could also just use the MySQL database and have a PHP script that outputs the contents of your report to a CSV (comma-separated value) file with an extension of .csv. Excel will automatically open these files without problem. -- Ben Ramsey Zend Certified Engineer http://benramsey.com --- Atlanta PHP - http://www.atlphp.org/ The Southeast's premier PHP community. --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP Working With Excel File ?
[snip] With excel, export your exel file to CSV (by doing save as...) then you can import your CSV file to mysql using the phpmyadmin import interface [/snip] http://search.cpan.org/src/JMCNAMARA/Spreadsheet-WriteExcel-0.37/WriteEx cel/doc/WriteExcel.html There is a PHP version -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Working With Excel File ?
Can PHP work with Excel files as database ? If not, how can I conver it to MySQL format and reconvert it to Excel 'coz I need it to report it in Excel format, if you are on windows you could use a com object. if you have access to perl, you could use http://search.cpan.org/~kwitknr/Spreadsheet-ParseExcel-0.2603/ParseExcel.pm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Working With Excel File ?
Matt M. wrote: Can PHP work with Excel files as database ? If not, how can I conver it to MySQL format and reconvert it to Excel 'coz I need it to report it in Excel format, if you are on windows you could use a com object. if you have access to perl, you could use http://search.cpan.org/~kwitknr/Spreadsheet-ParseExcel-0.2603/ParseExcel.pm You could also just use the MySQL database and have a PHP script that outputs the contents of your report to a CSV (comma-separated value) file with an extension of .csv. Excel will automatically open these files without problem. -- Ben Ramsey Zend Certified Engineer http://benramsey.com --- Atlanta PHP - http://www.atlphp.org/ The Southeast's premier PHP community. --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Working With Excel File ?
I think the easiest way is to store your data in MySQL and then create a DSN via MyODBC and connect to your spreadsheet. Matt M. [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Can PHP work with Excel files as database ? If not, how can I conver it to MySQL format and reconvert it to Excel 'coz I need it to report it in Excel format, if you are on windows you could use a com object. if you have access to perl, you could use http://search.cpan.org/~kwitknr/Spreadsheet-ParseExcel-0.2603/ParseExcel.pm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Working With Excel File ?
Yes, I'm planning to work with MySQL, but the problem accour from the first time, 'cause the source is in Excel file, is MySQL able to read the CVS format ?, and can you please show me some PHP script that make outputs the contents of report to a CSV from MySQL ? --- Ben Ramsey [EMAIL PROTECTED] wrote: Matt M. wrote: Can PHP work with Excel files as database ? If not, how can I conver it to MySQL format and reconvert it to Excel 'coz I need it to report it in Excel format, if you are on windows you could use a com object. if you have access to perl, you could use http://search.cpan.org/~kwitknr/Spreadsheet-ParseExcel-0.2603/ParseExcel.pm You could also just use the MySQL database and have a PHP script that outputs the contents of your report to a CSV (comma-separated value) file with an extension of .csv. Excel will automatically open these files without problem. -- Ben Ramsey Zend Certified Engineer http://benramsey.com --- Atlanta PHP - http://www.atlphp.org/ The Southeast's premier PHP community. --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Working With Excel File ?
Hi, Can PHP work with Excel files as database ? If not, how can I conver it to MySQL format and reconvert it to Excel 'coz I need it to report it in Excel format, Thx ___ Do you Yahoo!? Express yourself with Y! Messenger! Free. Download now. http://messenger.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Working With Excel File ?
On Monday 01 November 2004 02:58 am, Sejati Opreker wrote: Hi, Can PHP work with Excel files as database ? If not, how can I conver it to MySQL format and reconvert it to Excel 'coz I need it to report it in Excel format, With exel, export your exel file to CSV (by doing save as...) then you can import your CSV file to mysql using the phpmyadmin import interface. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Working With Excel File ?
On Monday 01 November 2004 02:58 am, Sejati Opreker wrote: Hi, Can PHP work with Excel files as database ? If not, how can I conver it to MySQL format and reconvert it to Excel 'coz I need it to report it in Excel format, Thx With exel, export your exel file to CSV (by doing save as...) then you can import your CSV file to mysql using the phpmyadmin import interface. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP not working with apache2
Grant wrote: I'm running Gentoo Linux, and emerged (installed) squirrelmail which automatically installed all of its dependencies including PHP and (I think) mod_php. PHP doesn't seem to be working though, as I always end up looking at the raw PHP code in a browser. I do have apache and apache2 installed on my system, and I suspect some key PHP things may have been set up for apache instead of apache2. Does anyone have any pointers? In Gentoo, emerge php just installs the client build, emerge mod_php installs the Apache module. Therefore, what you need to do is emerge -av mod_php Also, emerge apache installs Apache2, eventhough you may see apache and apache2 in /etc/ Then edit /etc/conf.d/apache2 and add -D PHP4 to the APACHE2_OPTS variable. Finally, issue /etc/init.d/apache2 restart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP not working with apache2
I'm running Gentoo Linux, and emerged (installed) squirrelmail which automatically installed all of its dependencies including PHP and (I think) mod_php. PHP doesn't seem to be working though, as I always end up looking at the raw PHP code in a browser. I do have apache and apache2 installed on my system, and I suspect some key PHP things may have been set up for apache instead of apache2. Does anyone have any pointers? - Grant __ Do you Yahoo!? Y! Messenger - Communicate in real time. Download now. http://messenger.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP not working with apache2
Grant wrote: I'm running Gentoo Linux, and emerged (installed) squirrelmail which automatically installed all of its dependencies including PHP and (I think) mod_php. PHP doesn't seem to be working though, as I always end up looking at the raw PHP code in a browser. I do have apache and apache2 installed on my system, and I suspect some key PHP things may have been set up for apache instead of apache2. Does anyone have any pointers? http://us2.php.net/manual/en/install.unix.php -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP not working with apache2
--- John Holmes [EMAIL PROTECTED] wrote: Grant wrote: I'm running Gentoo Linux, and emerged (installed) squirrelmail which automatically installed all of its dependencies including PHP and (I think) mod_php. PHP doesn't seem to be working though, as I always end up looking at the raw PHP code in a browser. I do have apache and apache2 installed on my system, and I suspect some key PHP things may have been set up for apache instead of apache2. Does anyone have any pointers? http://us2.php.net/manual/en/install.unix.php Thank you for the link. This section seems to apply to me: Common Problems If you see the PHP source instead of the result the script should produce, you have probably forgot to edit /etc/conf.d/apache. Apache needs to be started with the -D PHP4 flag. To see if the flag is present, you should be able to see it when using ps ax | grep apache while Apache is running. but I have already added -D PHP4 to my /etc/conf.d/apache2 file and the ps ax | grep apache2 command verifies that. Any ideas? - Grant __ Do you Yahoo!? Yahoo! Mail - 50x more storage than other providers! http://promotions.yahoo.com/new_mail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP not working with apache2
On Sunday 15 August 2004 07:45, Grant wrote: I'm running Gentoo Linux, and emerged (installed) squirrelmail which automatically installed all of its dependencies including PHP and (I think) mod_php. PHP doesn't seem to be working though, as I always end up looking at the raw PHP code in a browser. I do have apache and apache2 installed on my system, and I suspect some key PHP things may have been set up for apache instead of apache2. Does anyone have any pointers? Shouldn't you be asking this on the Gentoo list? At the very least so that the package packagers would know that there is something wrong with their packages. And the fact that you have both apache and apache2 installed complicates matter slightly. How does Gentoo handle it? Does it install PHP for both? Which apache are you hitting when you see the raw PHP code? Unless you know what you're doing why have you got two apaches installed? Etc. -- 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 -- /* NOTICE: Anyone seen smoking will be assumed to be on fire and will be summarily put out. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP not working with apache2
--- Jason Wong [EMAIL PROTECTED] wrote: On Sunday 15 August 2004 07:45, Grant wrote: I'm running Gentoo Linux, and emerged (installed) squirrelmail which automatically installed all of its dependencies including PHP and (I think) mod_php. PHP doesn't seem to be working though, as I always end up looking at the raw PHP code in a browser. I do have apache and apache2 installed on my system, and I suspect some key PHP things may have been set up for apache instead of apache2. Does anyone have any pointers? I have asked about this on the Gentoo list and was told to add -D PHP4 to an apache2 directive. I did that, but it still doesn't work. Having apache and apache2 installed is some kind of a mistake. I'm a newbie and not sure how it happened. I plan on completely starting over and setting up my server again from nothing to make it very clean, but everything except PHP is working great. This is the absolute last thing standing in the way of going live. When I see the raw code I am hitting apache2 as apache is not running. The only reason I need PHP is squirrelmail. Is mod_php necessary in this situation? - Grant __ Do you Yahoo!? Yahoo! Mail is new and improved - Check it out! http://promotions.yahoo.com/new_mail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP not working with apache2
On Sunday 15 August 2004 10:09, Grant wrote: I have asked about this on the Gentoo list and was told to add -D PHP4 to an apache2 directive. I did that, but it still doesn't work. Then escalate the issue! Or go through the chapter: manual Installation Servers-Apache 2.0 to make sure that all the steps outlined have been performed correctly by the emerge. Having apache and apache2 installed is some kind of a mistake. I'm a newbie and not sure how it happened. I plan on completely starting over and setting up my server again from nothing to make it very clean, but everything except PHP is working great. This is the absolute last thing standing in the way of going live. That's a good idea. Like I said unless you know what you're doing having both apaches installed is not a very good idea. When I see the raw code I am hitting apache2 as apache is not running. The only reason I need PHP is squirrelmail. Is mod_php necessary in this situation? I would guess yes, but it all depends on how your system is setup. Furthermore you have to establish 1) whether mod_php is installing against apache, apache2, or both 2) whether squirrelmail is installing against apache, apache2, or both Again, the Gentoo list is what you want. -- 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 -- /* Whom the mad would destroy, first they make Gods. -- Bernard Levin */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] cron job for php not working
Hi there, I am trying to install following cron job: 0 6 * * * php /home/www/project/app_cron/follow_up_new_members.php The script works, if I run this php /home... line manually it works out, but it does not automaticaly at 6 am as supposed. I do also see in /var/log/messages that the cron job has happened at that time, but the file did not generate the emails like it supposed to. I am running the crontab as webserver user. Thanx for any helpful ideas on that, Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] cron job for php not working
[snip] I am trying to install following cron job: 0 6 * * * php /home/www/project/app_cron/follow_up_new_members.php The script works, if I run this php /home... line manually it works out, but it does not automaticaly at 6 am as supposed. I do also see in /var/log/messages that the cron job has happened at that time, but the file did not generate the emails like it supposed to. [/snip] At the command line type which php and it will return the full path to php. Modify your line in the crontab with the full path... 0 6 * * * /usr/local/bin/php /home/www/project/app_cron/follow_up_new_members.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cron job for php not working
On Thursday 20 May 2004 11:35 am, Jay Blanchard wrote: At the command line type which php and it will return the full path to php. Modify your line in the crontab with the full path... 0 6 * * * /usr/local/bin/php /home/www/project/app_cron/follow_up_new_members.php I always put the #!/usr/local/bin/php at the top of all my command line php scripts. Mine is actually #!/usr/bin/php. Then chmod 755 the file so that it can execute. James Hicks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cron job for php not working
It looks like that cron line is making it so that the command runs as the user php... so, you should check if that user has permission to run the script. Tim. At 08:33 AM 5/20/2004, Merlin wrote: Hi there, I am trying to install following cron job: 0 6 * * * php /home/www/project/app_cron/follow_up_new_members.php The script works, if I run this php /home... line manually it works out, but it does not automaticaly at 6 am as supposed. I do also see in /var/log/messages that the cron job has happened at that time, but the file did not generate the emails like it supposed to. I am running the crontab as webserver user. Thanx for any helpful ideas on that, Merlin -- 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] Re: Working with MS-SQL
Make sure you have the dll or so loaded. mssql_connect(IP#, username, password); [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, How can we connect to MS-SQL Server ? What tools ( where can we download ) must be installed ? Thank a lots. PS : the php programs under Linux / Unix... Ed. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Working with a Front Page developer
Chris De Vidal [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Can anyone recommend some template engines? Or tips on using PHP to parse an HTML doc, replacing it with real data? You could also try TemplateTamer, and I would be glad to help you out if with it if needed. rush -- http://www.templatetamer.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP not working with Apache
The php installer doesn't do everything for a windows installation. You'll need to edit php.ini httpd.config for apache, as described in the installation guide. Raditha Dissanayake wrote: Yes sounds like you have not read the installation guide. Mark Mark wrote: I am running Apache 1.3.29 and PHP 4.3.3. I installed apache first and got it to work. Then, I install the php installer and and copied the windows binary files. I followed the instruction to run as a module and I even uninstalled the php files and tried to run PHP as just a CGI binary, both methods failured. I created a test php script called hello.php and the web page was blank when I tried to access it. I could view the code... Any ideas? I am running WIN 2K server sp4. Thanks in adavnce - Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP not working with Apache
I am running Apache 1.3.29 and PHP 4.3.3. I installed apache first and got it to work. Then, I install the php installer and and copied the windows binary files. I followed the instruction to run as a module and I even uninstalled the php files and tried to run PHP as just a CGI binary, both methods failured. I created a test php script called hello.php and the web page was blank when I tried to access it. I could view the code... Any ideas? I am running WIN 2K server sp4. Thanks in adavnce - Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it!
Re: [PHP] PHP not working with Apache
Yes sounds like you have not read the installation guide. Mark Mark wrote: I am running Apache 1.3.29 and PHP 4.3.3. I installed apache first and got it to work. Then, I install the php installer and and copied the windows binary files. I followed the instruction to run as a module and I even uninstalled the php files and tried to run PHP as just a CGI binary, both methods failured. I created a test php script called hello.php and the web page was blank when I tried to access it. I could view the code... Any ideas? I am running WIN 2K server sp4. Thanks in adavnce - Do you Yahoo!? Yahoo! SiteBuilder - Free web site building tool. Try it! -- 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 150 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: working with files
Did you try file(); ? -- // DvDmanDT MSN: dvdmandt¤hotmail.com Mail: dvdmandt¤telia.com Tony [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] hi, i have problem with writing a reading to file i want to write emails in files. like this [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] etc.. this is how I write to the file $handle = fopen($filename, a); fwrite($handle,$email\n,128); fclose($handle); ok it writes everything just fine but now i want to read the file line by line and print line by line. this is how i do it. ?php $handle = fopen ($filename, r); do { $data = fread($handle, 128); if (strlen($data) == 0) { break; } print ($databr); } while (true); fclose($handle); ? the problem i get then is everything is printed in one line. any help is appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: working with files
I'm new to php, and i tried file() no luck $lines = file('$filename'); foreach ($lines as $line_num = $line) { print (option value=\$line\$line/option); } thanx for the help Dvdmandt [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Did you try file(); ? -- // DvDmanDT MSN: dvdmandt¤hotmail.com Mail: dvdmandt¤telia.com Tony [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] hi, i have problem with writing a reading to file i want to write emails in files. like this [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] etc.. this is how I write to the file $handle = fopen($filename, a); fwrite($handle,$email\n,128); fclose($handle); ok it writes everything just fine but now i want to read the file line by line and print line by line. this is how i do it. ?php $handle = fopen ($filename, r); do { $data = fread($handle, 128); if (strlen($data) == 0) { break; } print ($databr); } while (true); fclose($handle); ? the problem i get then is everything is printed in one line. any help is appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: working with files
I use to do this: $lines=file($filename); $num_lines=count($lines); for($i=0;$i$num_lines;$i++)echo 'option value='.$lines[$i].''.$lines[$i].'/option'; -- // DvDmanDT MSN: dvdmandt¤hotmail.com Mail: dvdmandt¤telia.com Tony [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] I'm new to php, and i tried file() no luck $lines = file('$filename'); foreach ($lines as $line_num = $line) { print (option value=\$line\$line/option); } thanx for the help Dvdmandt [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Did you try file(); ? -- // DvDmanDT MSN: dvdmandt¤hotmail.com Mail: dvdmandt¤telia.com Tony [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] hi, i have problem with writing a reading to file i want to write emails in files. like this [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] etc.. this is how I write to the file $handle = fopen($filename, a); fwrite($handle,$email\n,128); fclose($handle); ok it writes everything just fine but now i want to read the file line by line and print line by line. this is how i do it. ?php $handle = fopen ($filename, r); do { $data = fread($handle, 128); if (strlen($data) == 0) { break; } print ($databr); } while (true); fclose($handle); ? the problem i get then is everything is printed in one line. any help is appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: working with files
tony wrote: I'm new to php, and i tried file() no luck $lines = file('$filename'); foreach ($lines as $line_num = $line) { print (option value=\$line\$line/option); } $lines = file ( $filename ); $size = sizeof ( $lines ); for ( $i = 0; $i $size; $i++ ) { echo ( 'option value=' . $lines[$i] . '' . $lines[$i] . '/option' ); } http://us2.php.net/manual/en/ref.filesystem.php -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] include working....but confusion
Hi, A bit confused here... this is my programs logic: if(multipleProducts==1) {include multiple_products_looping_code.php;} else {include single_products_code.php;} I am doing the above because some of the code is pretty big and it makes life simlier if I just add the code when I need it. Only problem is: when i include the code for multiple products...its outputting the raw code from there!! Do I have to start and end the included files with ?php ? ? Thanks, -Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include working....but confusion
From: Ryan A [EMAIL PROTECTED] Do I have to start and end the included files with ?php ? ? Yes. One day you'll learn to spend the two seconds trying this instead of asking the list. I'll be so proud of you then! ;) ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include working....but confusion
Hey, Thanks for the very informative reply but I did try itproblem is, it seems to work with and without...thats why the confusion. I have one program like the one i outlined and the second one, like this: some html code goes here some output stuff goes here something ? php stuff? something something etc Which was working fine... thats why i got confused. But its nice to know that you *too* are looking forward to the day that you will be proud of me :-p Cheers, -Ryan On 1/20/2004 7:13:51 PM, CPT John W. Holmes ([EMAIL PROTECTED]) wrote: From: Ryan A [EMAIL PROTECTED] Do I have to start and end the included files with ?php ? ? Yes. One day you'll learn to spend the two seconds trying this instead of asking the list. I'll be so proud of you then! ;) ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include working....but confusion
From: Ryan A [EMAIL PROTECTED] Thanks for the very informative reply but I did try itproblem is, it seems to work with and without...thats why the confusion. I have one program like the one i outlined and the second one, like this: some html code goes here some output stuff goes here something ? php stuff? something something etc Which was working fine... thats why i got confused. Okay... I guess I could see that. The include is going to start in HTML mode. That's why the above works because you're starting with HTML. If the include file is all PHP code, then the file is still going to start in HTML mode, though. So you have to open PHP mode with ?php. Now, that being said, there was a discussion on here a while ago that you don't _really_ have to close PHP mode at the end of your file and there were certain pros and cons to doing so. Adapt to your needs. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php