Jump to content

jimmyborofan

Members
  • Posts

    12
  • Joined

  • Last visited

Everything posted by jimmyborofan

  1. I have a cron job that grabs a list of folders that need processing These folders are scanned for a particular type of file and then those are processed. I am trying to get this to run as a parallel process by using exec. The complication arises when the it is called, it just doesnt seem to call the function. I use the codeigniter framework with the cli.php found on this very site (thank you whoever wrote that!) The loop works like this: public function loopBatchDir() { [...] begin Loop foreach ($batches as $batch) { exec("php /var/path/to/webroot/cli.php Controller backgroundProcess".$batch['filename'] . " > /dev/null &") } end Loop } public function backgroundProcess() { /*this is the test section */ echo "I have been called"; /*end test section*/ $batchFile = $this->uri->segment(4); $this->batch->insertBatchData() } SO when I call backgroundProcess() from the command line the I get the echo and the process executes (when providing a correct parameter When the loopBatchDir() is called by command line the entire process works fine, but the exec command is completley ignored. Other Info: This is on a fresh dedicated server that we have exclusive use of, I have had to make changes to several php settings and I am also wondering if exec is function that has to be turned on in php.ini? Any help, appreciated. Jim
  2. I have a client who has an odd week numbering pattern, different Years have different week number starting dates (e.g. Academic starts in September, Tax year is April, etc etc) I know you can get the week number using date("W") if I do this with todays date (2/JAN/10) I get 53 (it is the last day of the last week of the year, the new year starts tomorrow) My clients trading year begins on Dec 25th, so I need to be able to work out week numbers from then. Any pointers would be gratefully recieved. Jimmy
  3. Hi i got this problem... basically I have an array say: $cartArray this is a session variable and it stores the value of a cart. the array contains the items that the user has clicked on and chosen to add. now I have done all the transaction work I have added the transaction to the db, I have closed the session when it everything has been done, I am now stuck with the problem of stock. the array contains the names of the items and nothing else i have used this array to retrieve price information from the db so that the user gets a total price so I have no probems there. this is where it gets difficult, adjusting the stock values, :-\ I somehow how to get the number of times that each value has appeared in the array ( I am doing this with the array_count_values() function) so I am now left with another array which lists how many times each item has been listed in the cart, I have this done so far and can display what the array contains, so I know that this is working. now I have my difficult bit which I am having problems, how can take the values from this counted array and use them to adjust the values of stock in the db? ??? I am really stuck! if someone could let me know which functions would come in useful or a few pointers I would be made up! thanks in advance Jimmy
  4. You diamonds! Thank you its now working and I can finally get on with the rest of the stuff that I need to do! (dont worry though... No doubt when my next assignment comes along I will be back here!) Thanks peeps Jimmy
  5. right then here goes... After the help I had earlier I have begun to try to pass a value across from one page to another dependiong upon the value, the page displays one thing or another ( I know this is simple stuff but seriously <------------------------NEWBIE!!!!!!!!!!!!!!!!!!!!! see what I mean...) okay the code I have so far has a page with four links that show countries when sent to the second page, the page should display the capital. Here is the code: link.html <html> <body> <p><a href="contact.php?$country=UK">The United Kingdom</a></p> <p> <a href="contact.php?$country=US">The United States</a></p> <p><a href="contact.php?$country=FR">France</a></p> <p> <a href="contact.php">Not sure...</a></p> </body> </html> and this is the page that the values are sent too: capitals.php: <html> <body> <?php $country = $_GET['$country']; switch ($country) { case 'UK': $capital = 'London'; break; case 'US': $capital = 'Washington'; break; case 'FR': $capital = 'Paris'; break; default: $capital = 'Unknown'; break; } ?> <?=$capital?> </body> </html> As other members may see I am trying to transpose from what I know of asp across to php, now absolutley nothing happens! Please could somebody give me some direction or just plainly point out where I have gone wroing then give me a slap on the back of the head! lol Jimmy
  6. Tops, That will save me a shed load of carpal tunnel when it comes to my exam!
  7. That is fantastic! Thank you, I have really being tearing what little hair I have left out over this one! I may be able to begin to make some progress now! Thanks again Jimmy
  8. okay I have generally used classic asp previously and my next (and future modules) deal only with PHP, which is unfortunate for me as I don't have a clue... The only way I know how to give an example of this is in asp and I hope that someone out there knows what I need! Any way I need to create a few pages and for the sake of code reuse I want to do this in a particular way, now if I was to create the links that I want in classic asp I would create two pages like this: link.asp: <p><a href="contact.asp?id=feedback">Feedback</a></p> <p> href="contact.asp?id=contact">Contact</a></p> this first would provide the links to this page: contact.asp: <html> <body> <% Dim strErrType, strHeadline, strMessage 'get the error type strErrType = Request.QueryString("id") 'test the error type Select Case strErrType Case "contact" strHeadline = "<h3>Hello!</h3>" strMessage = "<p>You have chosen the Contact link.</p>" Case "feedback" strHeadline = "<h3>Hello!</h3>" strMessage = "<p>You have chosen the feedback link.</p>" End Select %> <%=strHeadline%> <%=strMessage%> </body> </html> now when the link is sent to contact.asp it chooses which CASE has been sent through and displays the relevant info. if you choose contact.asp?id=feedback you would get the feedback message etc, both sent to the same page but depending upon the query string, displays a different message. (if you copy both these pages and run them as named through IIS or apache with asp installed, they will work and show what I mean) I hope that this is clear enough! So I need to do the equivalent in PHP, please can anyone put me (or push me) in the right direction so that I can do this please! with thanks in advance Jimmy
  9. Yay! Thanks a lot peeps It is all working perfectly now, I used the first tutorial and realised that the extensions directory was not set correctly and the ISAPI filters were not pointed correctly either. I have resolved this issue and my thanks go to all who helped Jimmy PS can I give rep points on here?
  10. Thanks for the speedy replies people I am going to try Apache one more time as I was unable to install the Apache::ASP mod, but the link provided says that it is included within the perl mod, so I am going to try it. I am also going to try the tutorials first as I dont really want to move away from IIS as I have grown pretty used to it over the time Thanks peeps no doubt as I am a newbie to PHP I am likely to be on here a little more to bug you all! Jimmy
  11. As far as I am aware it is 5.1 it is the srandard set up that comes with XP, I have to ask though does it make a difference if it is 5.1 or 6? I didnt know... Jimmy
  12. I have a real pain, I have installed and uninstalled - reinstalled, deleted removed added changed mixed around added to Path copied dll's all over the place, and this is what happens: Whenever I try to view a .php page via IIS (XP Pro btw) what happens is not what I expected: I tried this: <? PHPINFO() ?> and this is what is displayed: normally if the install has not worked it asks me if I would like to download the file rather than display what it is supposed to do. I get is the file in text with no PHP working at all. if I try this: <html> <head> <title>My First PHP Page</title> </head> <body> <?php echo "Hello World!"; ?> </body> </html> All I get is a blank browser screen Please can any body give me an idea of what I am doing wrong, if you need any more info please just ask and I will post back ASAP. Many thanks in advance Jimmy
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.