Running PHP script via ColdFusion

I'm running CFMX 7 on a Solaris platform with PHP 5.0.5.
I need to determine the width and height of an uploaded image
to ensure that the file can be reasonably used on a web page. I
have scoured the Internet and found a numer of solutions to this.
Most need the installation of additional software on our server and
the creation of a custom tag. These are doable, but would require
additional effort I don't have time for at the moment. Also, the
software to install is a full image manipulation package that is
definitely overkill for my needs. Kind of like threading a needle
with a hammer.
On the other hand I know that PHP has a command called
"getimagesize" that would be perfect for my use. This would be much
more simple and elegant. And I have created a small program (see
below) that can accept a location of an image file and display the
width and height of the image as a result. The code is:
<?php
list($width, $height) = getimagesize($argv[1]);
echo "$width, $height";
?>
I've tested it via the command line and it works fine.
However, I'm having difficulty in running it via the ColdFusion
cfexecute tag. Here is that code:
<cfsavecontent variable="imgsize">
<cfexecute name="#phpfilelocation#"
arguments="#imagelocation#"></cfexecute>
</cfsavecontent>
I get nothing back from this. I've also tried the cfhttp tag
with similar results. It seems to me that the argument (the
location of the image) is not being accepted by the PHP code for
some reason.
I've looked for a solution to this within this forum and via
Google, etc. to no avail. There is apparently something about PHP
or ColdFusion that is escaping me. Any help clarifying why this is
not working and (hopefully) a workaround would be very much
appreciated. Thank you.

Maybe this will help:
http://groups.google.com/group/alt.comp.lang.coldfusion/msg/af84ac7dfec0d09e?dq=&hl=en&lr= &ie=UTF-8&oe=UTF-8&rnum=8

Similar Messages

  • Help with PHP script to Coldfusion

    I have a PHP script that I need to create in coldfusion. I'm
    fairly new to coldfusion and would appreciate any help. Here is the
    PHP script... The code is suppose to retrieve the HTTP POST data
    from the url. I would be open to doing this in Javascript as well.
    Thanks again...
    /* Script Start */
    //Get the file POST data
    $filePost = $_POST[$filePostVariable];
    //Break the file list into an array
    $filePost = explode($fileDelimiter, $filePost);

    <cfset arrayList = ListToArray(url.urlVar)>
    I accessed the URL vars directly via url scope, and the
    default delimiter is comma otherwise add a delimiter to the
    listToArray function. In the PHP example it looks like you had a
    var that held the url var name. I hope this helps.
    Trevor
    Visit Me

  • RUNNING PHP SCRIPT WITH ZEND FRMWRK IN WINDOWS TASK SCHEDULER

    I have a PHP script which includes the Zend framework Mail.php for sending mails.
    I am running a WAMP server and i used DW to create it.
    I want to run my script in every 5 mins, How i can schedule it in Windows task scheduler.
    I tried running a bat which contains the php.exe path and arguments as php file but it gives an error that zend/mail.php not found.
    Please help its really urgent.

    Thanks for your response.
    bat file has:
    path of the php.exe -f path of php file.
    But when it runs it gives an error that the zend framework file not found.
    I have a seperate PHP includes folder under which zend FW is stored.
    That folder is marked in includes_paths in php.ini.

  • Need to run php script before the Flash component kicks in

    I have a slide show component in Flash which uses an xml file to load images. The xml file, however, is created dynamically when the user selects which slide show they want to see. How do I run the php script BEFORE the slide show component has a chance to look for it? Usually it begins as soon as the .swf is run.
    thanks,
    chop

    thank you for responding.
    I'm still new at as3 so forgive me for needing details.
    I searched adobe for help and came up with the following to import the component. However, it seemed too easy to be true and so it was. I received errors when I ran it. The component is a commercial one called SlideshowBox and is in my library with that exact name.
    //add a component to the stage
    import fl.controls.SlideshowBox;
    var aSlideshowBox:Button = new Button();
    addChild(aSlideshowBox);
    errors:
    Scene 1, Layer 'Actions', Frame 1, Line 3    1172: Definition fl.controls:SlideshowBox could not be found.
    Scene 1, Layer 'Actions', Frame 1, Line 3    1172: Definition fl.controls:SlideshowBox could not be found.
    Scene 1, Layer 'Actions', Frame 1, Line 4    1180: Call to a possibly undefined method Button.
    thank you, k

  • Running php scripts on development server

    Hi,
    I have Coldfusion development server and Apache running on my local host. CF is on port 8500 and Apache is running on port 80.
    On my remote host in plesk I can add support for Coldfusion and PHP, is there a way to run PHP files on localhost:8500?
    Thanks

    Sweet. I run this setup on Mac 10.5.7 and it's great (PHP & CFML on port 80, that is).
    The easiest solution is to reinstall CF as a multi-server and run the connectors for Apache. The most recent CF (8.0.1) Mac installer is 'built' for Leopard, so it works well.
    Mark Drew has a good post:
    http://www.markdrew.co.uk/blog/post.cfm/running-coldfusion-8-on-leopard
    Aaron West also has an excellent post on CF 8 & Leopard:
    http://www.trajiklyhip.com/blog/index.cfm/2008/1/14/ColdFusion-8-Apache-22x-and-OS-X-105-L eopard
    If you run into a snag, PM me & I can help more (I've freaking installed this $%&@ thing so many times )!

  • Run PHP script

    Hello, everybody. I'm wondering if it's possible to run a HTML PHP script in a report region which type is HTML format? Something like:
    <?php
    echo phpinfo();
    ?>
    As I can imagine, this code could not be handled to PHP compiler although as I know, the ORACLE appication server has been compiled together with PHP 5. So is there any tricks to make this work, or does APEX have some plan to make similar things work in the later version?
    Thanks!

    I have a PHP application that opens up a template (MS
    Word) invoice file, inserts some information in the
    file (eg. today's date, customer name) and then saves
    it as a new Word file. My questions are as follows.
    1- How can I call this script from my Java
    application. Please note that I want to be able to
    pass parameters (eg. custome name read from a DB) from
    my Java app. to this script.You would have to call the PHP interpreter through Runtime.exec(), I believe. I haven't done anything with it, but you would have to build the command that would normally be typed on the command line as a string and pass it to Runtime.exec().
    2- Is it possible to print already saved MS Word
    documents from Java? If so, how?Try looking at the Jakarta POI project.
    3- Is it possible to do what my PHP script is doing in
    pure Java? I couldn't find a simple way of doing this,
    that's why I used PHP but I would like to do this in
    Java if I can.Same as 2.

  • Launchd not running php script in background

    Hi there,
    I am trying to run a php script repeatedly after every 2 minutes using launchd. I am using mac 10.9.2.
    Here is my plist file-->
    com.mycompanyname.mydepartment.mytaskname.plist
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>Label</key>
        <string>com.mycompanyname.mydepartment.mytaskname</string>
        <key>ProgramArguments</key>
        <array>
              <string>/Applications/XAMPP/xamppfiles/htdocs/oauth/job.php</string>
        </array>
        <key>StartInterval</key>
        <integer>50</integer>
    </dict>
    </plist>
    /Applications/XAMPP/xamppfiles/htdocs/oauth/job.php --->
    #!/usr/bin/php
    <?php 
    $File = "YourFile.txt"; 
    $Handle = fopen($File, 'a');
    $Data = "Jane Doe\n"; 
    fwrite($Handle, $Data); 
    $Data = "Bilbo Jones\n"; 
    fwrite($Handle, $Data); 
    print "Data Added"; 
    fclose($Handle); 
    ?>
    My command line for your reference-->
    studio-film1:oauth MetricFilm$ sudo chmod a+x job.php
    studio-film1:oauth MetricFilm$ sudo cp com.mycompanyname.mydepartment.mytaskname.plist /Library/LaunchDaemons
    studio-film1:oauth MetricFilm$ sudo launchctl load -w /Library/LaunchDaemons/com.mycompanyname.mydepartment.mytaskname.plist
    studio-film1:oauth MetricFilm$ sudo launchctl load -w /Library/LaunchDaemons/com.mycompanyname.mydepartment.mytaskname.plist
    com.mycompanyname.mydepartment.mytaskname: Already loaded
    When i drag and drop my job.php script on terminal, it shows its path and when i enter.... It is not giving me any error & it is running on command line too & creating "YourFile.txt" if it does not exists & if it exists then it writes two lines into it.
    Problem is---->
    "YourFile.txt"  is not getting generated neither if it is there is getting written by php script. Which means it is not running into memory even a once.
    What should i do to make launchd run this script repeatedly.
    Thanking you

    Thanks dear,
    Should i change relative path mentioned into PLIST file
    <string>/Applications/XAMPP/xamppfiles/htdocs/oauth/job.php</string>
    to Absolute...?
    And is there any other command to start a plist task running after we have loaded it with launchctl??
    Thank you

  • Run PHP script in Java app.

    Hi,
    I have a PHP application that opens up a template (MS Word) invoice file, inserts some information in the file (eg. today's date, customer name) and then saves it as a new Word file. My questions are as follows.
    1- How can I call this script from my Java application. Please note that I want to be able to pass parameters (eg. custome name read from a DB) from my Java app. to this script.
    2- Is it possible to print already saved MS Word documents from Java? If so, how?
    3- Is it possible to do what my PHP script is doing in pure Java? I couldn't find a simple way of doing this, that's why I used PHP but I would like to do this in Java if I can.
    thanks in advance,
    Mete

    I have a PHP application that opens up a template (MS
    Word) invoice file, inserts some information in the
    file (eg. today's date, customer name) and then saves
    it as a new Word file. My questions are as follows.
    1- How can I call this script from my Java
    application. Please note that I want to be able to
    pass parameters (eg. custome name read from a DB) from
    my Java app. to this script.You would have to call the PHP interpreter through Runtime.exec(), I believe. I haven't done anything with it, but you would have to build the command that would normally be typed on the command line as a string and pass it to Runtime.exec().
    2- Is it possible to print already saved MS Word
    documents from Java? If so, how?Try looking at the Jakarta POI project.
    3- Is it possible to do what my PHP script is doing in
    pure Java? I couldn't find a simple way of doing this,
    that's why I used PHP but I would like to do this in
    Java if I can.Same as 2.

  • Running Calc Scripts via Workspace

    Currently users are given 'admin' access to Essbase. That way when they are in Workspace they can see and run calc scripts on their apps. Is there a more proper way to give users the ability to run a calc on their apps without giving them 'admin' access?

    We have the calc scripts that run for data loads and other automated processes. Some of these calc's which are just AGG's and Calc Dim's I guess could be BR's too, but then we would have duplicates......
    Thats the sorry reason :)

  • Running PHP Script

    I've enabled the Apache server on my mac, and when I access my local IP address I can see the web page I've created. However, it appears that the server doesn't process PHP scripts, and just returns the source code of the PHP script when I try to open the script in Safari 4. How do I get the built-in Apache server to process PHP scripts and return the desired result?

    PHP is disabled by default. To enable it, you must edit Apache's configuration file. To do this, open up /private/etc/apache2/httpd.conf with a text editor. The file is owned by root, so you'll need appropriate access to modify the file. Text editors like BBEdit or TextWrangler can make this step much easier.
    Fairly early on in the configuration file is the section for the Dynamic Shared Object support - these are the modules that Apache loads to enable it to perform various tasks. In this section are a whole bunch of "LoadModule" statements - one for each module that Apache is loading. One of these is for PHP support. In the httpd.conf file on my machine, the built-in PHP module's statement is on line 114, the next to last item in this section. It reads: "#LoadModule php5_module libexec/apache2/libphp5.so" Remove the "#" from the beginning of the line, save the file, and restart Apache.
    If you plan on using PHP files as the default page for a directory (index.php, for example), you'll need to add index.php to the Directory Index section (line 225 in my file). Apache looks for them in the order listed, so if you list index.php after the index.html that's already there, Apache will look for index.html when asked for the directory before looking for index.php. If you're going to have index.php for most of your directories, you may want to list it first, before index.html.
    With regard to PHP itself, Apple's included PHP isn't any more official that the one I mentioned from Marc Liyanage. They're both compiled from the same source code. And, as far as updating goes, I'd argue that it's easier to update Marc's version, as you simply download an updated version and the installer will overwrite the old version. And, you don't have to wait for Apple to release a new version of OS X or a security update to see if you get a more current version. His versions will almost always be more current than the one Apple provides.
    In any event, Marc's version does not remove Apple's version from your system. His installs in /usr/local/ and leaves Apple's version intact. So, you can always go back to Apple's version by changing a few lines in a configuration file.

  • Running PHP script from Java apps

    Hi,
    I have a PHP application that opens up a template (MS Word) invoice file, inserts some information in the file (eg. today's date, customer name) and then saves it as a new Word file. My questions are as follows.
    1- How can I call this script from my Java application. Please not that I want to be able to pass parameters (eg. custome name read from a DB) from my Java app. to this script.
    2- Is it possible to print already saved MS Word documents from Java? If so, how?
    3- Is it possible to do what my PHP script is doing in pure Java? I couldn't find a simple way of doing this, that's why I used PHP but I would like to do this in Java if I can.
    thanks in advance,
    Mete

    Don't reply here. Go here instead.
    http://forum.java.sun.com/thread.jsp?forum=54&thread=479160&tstart=0&trange=15
    Cross-listed
    Sorry, I thought this didn't post before.

  • Translating PHP Script to Coldfusion

    Hello,
    I need to translate this code (which is in PHP) to coldfusion, is there anyone who can help me please it´s urgent, thanks a lot.
    <?
    $ref = $_GET['Reference'];
    $act = $_GET['Action'];
    $par = $_GET['Param'];
    switch ($act) {
    case "DETAIL":
    echo "Reference=".$ref. "&Action=".$act."&Reponse=".$montant;
    break;
    case "ERREUR":
    echo "Reference=".$ref. "Action=".$act. "Reponse=OK";
    break;
    case "ACCORD":
    echo "Reference=".$ref. "Action=".$act. "Reponse=OK";
    break;
    case "REFUS":
    echo "Reference=".$ref. "Action=".$act. "Reponse=OK";
    break;
    case "ANNULATION":
    echo "Reference=".$ref. "Action=".$act. "Reponse=OK";
    break;
    ?>  

    When you're approaching the task of "translating PHP to ColdFusion," and when you find yourself with just-a-moment where you are not "up to your earlobes in alligators" (i.e. when you can recall that "your original objective was to drain the moat ..."), then do try to step back and look at the forest not just the trees.  ColdFusion actually has a rather different philosophy toward designing applications, which can be summed up (I think) like this:
    Most web-tools (PHP, dot-Net, even Ruby and Perl) give you the ability to "write a program" that just happens to produce an HTML output.
    Content-management (CMS) systems are "really-nifty programs that have already been written for you."
    ColdFusion is an application-server system that uses an XML-based declarative syntax.  It is implemented on the back-end using a "just in time" compiler that cranks out the (Java and JavaScript) code for you.  Although many of the "tags" implement conventional procedural-programming constructs such as "switch" and "if" and "loop" and "call," you'll notice that many more do not.
    A good example of the difference between them, for me, is the <cftransaction> tag.  This tag declares to ColdFusion that the enclosed block is supposed to "be a database transaction."  This means, without you having to say anything further, that:
    A database transaction should be started.
    If all of the code within this block completes successfully, the database transaction should be committed.
    If an exception occurs within this block, the database transaction should be rolled-back (in addition to anything else that should happen as a consequence of an exception having occurred).
    The ColdFusion Engine parses that declarative tag and automagically generates the necessary Java code to implement it correctly, on-the-fly, then executes that code immediately.  You don't have to be consciously aware that this is happening, even though as an application designer you can.
    This strategy is especially useful when an application needs to be "scaled up" to run on multiple servers.  When ColdFusion is configured for that environment, the code that it on-the-fly generates is a little bit different.  But the page that you wrote, isn't.

  • Running Bash scripts via /Library/LaunchDaemons

    I have a .plist in /Library/LaunchDaemons that calls a Bash script that lives in /usr/bin.. ...
    With the script, one if the things I am trying to do is copy a directory from a non-admin user account, and place it on the administrator desktop.. Something like :
    cp -R /Users/myuser/theDirectoryIwant /Users/admin/Desktop
    The above code runs fine from Termimal ( I do 'sudo' first '), but if I add the line to the script...nothing seems to happen..I know the script is running ( I have it set for every hour in the .plist file, and I can see output in the Console) ...since it will run code such as this just fine :
    cd ~/Desktop
    mkdir Test
    I am guessing that anything called from usr/bin would not need 'sudo' in a shell script there since it is already running as root?

    I would suggest that you test your launchd environment out by capturing the output from
    date >/tmp/myscript.txt
    pwd >>/tmp/myscript.txt
    id >>/tmp/myscript.txt
    printenv >>/tmp/myscript.txt
    Now allow this to be run via your launchd .plist and then look at the output. That should tell you what your environment looks like when your .plist runs.

  • Run AS3 script via html codetag?

    From what I know, it is possible to add <a href="....">
    or <a href="mailto:..."> in order to set dynamically a
    specific substring of a text to do either navigation to other page,
    or open to e-mail client. But is it possible to do much more
    important things, by just calling an AS3-function?... I am talking
    about a hyperlink to AS3 script code, instead to email client /
    browser.
    I.e. I want to download dynamic text with the names of
    Authors of papers from a database, and parse them serial i.e.:
    Authors:
    Author1Name,
    Author2Name, ...,
    AuthorKName".
    When the user press on a name, to open a vector flash pop-up
    (MovieClip) as a data-card of the specific Author. This could be
    done if there was an Flash-HTML tag like <a
    fref="loadModule(1)">
    Author1Name</a>, which would run the
    loadModule(1) function of the parent MovieClip that contains
    the dynamic text.
    I know something like this doesn't exist (
    add it to wishlist for future versions! :) ), but is there
    any other way to do it, except from creating one Object per author
    with MouseEvent listeners and place them dynamically to correct x,y
    positions?...

    It's as you describe it, with one problem: the "button"
    position and size is dynamically text-depending and not known
    before the data parsed to screen.
    Example:
    Create a textField and add inside it a dynamic text like:
    "Bill Gates created Microsoft". If this text was static I could add
    2 transparency buttons (listening to: MouseEvent.CLICK), one over
    "Bill Gates" and one over "Microsoft", where the first would make
    visible a movieclip talking about Bill Gates, and the second would
    make visible one movieclip talking about Microsoft.
    But the text can come as: "Microsoft was created by Bill
    Gates", or "There is a company named Microsoft, which was created
    by Bill Gates", or "Windows is a software created by Microsoft.
    Bill Gates was the one that created Microsoft". Thus you can't have
    apriori knowledge on where to put the buttons. In more advanced
    examples, I might not know how many buttons I should place also
    (i.e. of authors - i don't know apriori how many authors a paper
    has).
    This is same as in case of hyperlink: We don't know where a
    hyperlink can be, thus we place a tag for every hyperlink into the
    text that defines that hyperlink position and action.
    The only way to overcome this problem (just though of it) is
    to create my own tag, and before parse the text to check for that
    tag. For every tag to find the starting coordinates of it's inside
    text on the parent movieclip (x,y) and the ending coordinates - and
    providing that they have the same y-coordinate (no line change), to
    create a transparent button at the specific area over the text.
    If this is the only way to do it (thus making my own
    pseudo-html tag inside flash),
    I must know if it is possible to take (x,y) coordinates (in
    pixels) of a letter (upperleft corner) in a dynamic textbox.
    kglad, do you know if this is possible and how to do it?... (It may
    need to open new thread for this)...

  • Run calc script via business rule

    Hello all,
    I have calc scripts and business rules in my hyperion essbase.
    one of the calc scripts e.g. aggregates some values.
    In the business rule i copied the code from the calc script and this business rule can be executed in the planning tool.
    Now, everytime when i change the code from the calc script, i have to change same things at the business rule.
    And now my question:
    Is it possible to start a calc script with the business rule?
    e.g. content of business rule: execute "calc_aggregate"
    Is there a command?
    Then it would save time and i only have to change the calc script and not both.
    Thanks for your efforts,
    Chris

    1) try to use essbase 9.3 with dataexport command in calc script (this version essbase is compatible with planning versions 9x and 4.1)
    2) you can write (or found in google) UDF function for run system command or (and) export data set
    3) you can run system command from Planning web and run CSC and RUL from essmsh
    ER

Maybe you are looking for