Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Page 3 of 3 FirstFirst 1 2 3
Results 31 to 39 of 39
  1. #31
    Member
    Join Date
    Dec 2008
    Posts
    31

    Default

    Is there no other way of calling MySQL functions without having to RENAME the EXTENSION. I mean addons like fantastico already have it and use it without renaming the extension
    It really looks bad to have a wierd extension like .phpcp, .cpphp or livephp, .live.php

    Please there got to be some other way as well like using PHPs exec(), system(), shell_exec()

    ALso $CPERROR{'mysql'} is in a normal PHP file and not LivePHP

  2. #32
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by rongup View Post
    Is there no other way of calling MySQL functions without having to RENAME the EXTENSION. I mean addons like fantastico already have it and use it without renaming the extension
    It really looks bad to have a wierd extension like .phpcp, .cpphp or livephp, .live.php

    Please there got to be some other way as well like using PHPs exec(), system(), shell_exec()

    ALso $CPERROR{'mysql'} is in a normal PHP file and not LivePHP
    CPError is part of the APIs, as such will not work in a regular PHP file. It needs to be a LivePHP file, .cpphp, .phpcp or called via our other APIs.

    Regarding Fantastico, in my limited use of their software, it seems to be a variety of HTML front-ends that post to PHP-based back-end scripts to perform the tasks of database creation etc. If you are not creating interfaces where the page must be dynamic and generated server-side rather than client-side (e.g. with JavaScript), you may want to do something similar to that.

  3. #33
    Member
    Join Date
    Dec 2008
    Posts
    31

    Default

    So there is ABSOLUTELY no way to:
    1) Run CPanel API1 & 2 and PHP simultaneously
    2) 1 is possible only by using the LIVE PHP framework

    Ok then I can still try two methods:
    a) Is it possible to execute a PHP FILE from within a PHP file using exec(), system() commands in PHP
    b) Is it possible to know the exact HTTP URL the user is using to access CPanel

    Also isnt :
    .phpcp means php first and CP 2nd
    .cpphp means cp first and PHP 2nd
    then .php should mean both running simultaneously

  4. #34
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by rongup View Post
    So there is ABSOLUTELY no way to:
    1) Run CPanel API1 & 2 and PHP simultaneously
    2) 1 is possible only by using the LIVE PHP framework
    Or you could create .cpphp or .phpcp files as I mentioned above.

    Quote Originally Posted by rongup View Post
    Ok then I can still try two methods:
    a) Is it possible to execute a PHP FILE from within a PHP file using exec(), system() commands in PHP
    b) Is it possible to know the exact HTTP URL the user is using to access CPanel
    The PHP installation for cpsrvd is not the same as the one used for Apache in many ways. First, it is a completely separate compile. Second, it runs as root. Third, it uses a separate php.ini file. This means you have full control over PHP as it is used by cpsrvd independently of the PHP used for Apache.

    If you need to customize php.ini for cpsrvd, edit the following file:

    /usr/local/cpanel/3rdparty/etc/php.ini

    Be mindful, this PHP runs as root.


    Quote Originally Posted by rongup View Post
    Also isnt :
    .phpcp means php first and CP 2nd
    .cpphp means cp first and PHP 2nd
    then .php should mean both running simultaneously
    The .php extension means only PHP, no API1/API2 tag processing within the cPanel interface.

  5. #35
    Member
    Join Date
    Dec 2008
    Posts
    31

    Default

    Can you just tell me where is the CPanel PHP Engine that parses <cpanel> tags
    I can then use exec(cpanel_phpengine path to_my_script_phpcp) and get the job done
    I tried the /usr/local/cpanel/3rdparty/bin/php but that is the standard PHP engine.
    I need the CPANEL ENGINE

    The following PHP code still gives error:
    PHP Code:
    echo shell_exec('/usr/local/cpanel/3rdparty/bin/php /usr/local/cpanel/base/frontend/x3/plugin/functions.live.php'); 
    The error given is "There was a problem connecting back to the cpanel engine. Make sure your script is ends with .live.php or .livephp"

    The file is a live.php but still no luck!
    Is it because of passing it through the wrong PHP :
    /usr/local/cpanel/3rdparty/bin/php

    Do you have a seperate PHP binary for CPanel PHP scripts.
    Please help me, I have spent over 5 days trying to figure this out.
    The reason I am using exec() is that I dont want to rename my index.php to index.live.php or index.phpcp or index.cpphp

    ANOTHER Thing,
    Why doesnt this work in php:
    shell_exec('/usr/local/cpanel/bin/mysqladmin uid ADDDB dbname');
    It works if i use SSH as root admin
    Even if i try to make my own PERL script it gives me an error:
    -bash: line 338: /usr/local/cpanel/bin/plugin: Permission denied

    Please Reply,
    Rongup
    Last edited by rongup; 01-27-2009 at 11:54 AM.

  6. #36
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by rongup View Post
    Can you just tell me where is the CPanel PHP Engine that parses <cpanel> tags
    I can then use exec(cpanel_phpengine path to_my_script_phpcp) and get the job done
    I tried the /usr/local/cpanel/3rdparty/bin/php but that is the standard PHP engine.
    I need the CPANEL ENGINE

    The following PHP code still gives error:
    PHP Code:
    echo shell_exec('/usr/local/cpanel/3rdparty/bin/php /usr/local/cpanel/base/frontend/x3/plugin/functions.live.php'); 
    The error given is "There was a problem connecting back to the cpanel engine. Make sure your script is ends with .live.php or .livephp"

    The file is a live.php but still no luck!
    Is it because of passing it through the wrong PHP :
    /usr/local/cpanel/3rdparty/bin/php

    Do you have a seperate PHP binary for CPanel PHP scripts.
    Please help me, I have spent over 5 days trying to figure this out.
    The reason I am using exec() is that I dont want to rename my index.php to index.live.php or index.phpcp or index.cpphp

    ANOTHER Thing,
    Why doesnt this work in php:
    shell_exec('/usr/local/cpanel/bin/mysqladmin uid ADDDB dbname');
    It works if i use SSH as root admin
    Even if i try to make my own PERL script it gives me an error:
    -bash: line 338: /usr/local/cpanel/bin/<<REMOVED>>: Permission denied

    Please Reply,
    Rongup
    The handling of API1/API2 tags is performed by cpsrvd itself, not PHP. As a result, you cannot make any calls to the PHP interpreter itself to attempt to execute these tags that are only parsed by cpsrvd itself. The cpsrvd service knows how to process the document by means of the file extension. Therefore, if you only want to use a .php extension, you will be limited to PHP without any API1/API2.

    I am not intimately familiar with command-line MySQL so I, personally, am unable to address that issue. However, feel welcome to submit a support request if you wish to pursue that issue further with the assistance of our technical analysts: http://tickets.cPanel.net/submit
    Last edited by cPanelDavidG; 01-27-2009 at 12:14 PM.

  7. #37
    Member
    Join Date
    Dec 2008
    Posts
    31

    Default

    I have submitted the ticket but please if you could ask someone and let me know it would be great.
    I have spend days on getting this thing done but with no luck.
    Please I request you to just help me with this shell execution stuff.
    There are 1000s of Command Line Perl Functions within /usr/local/cpanel/bin which are all the things i require!

  8. #38
    Member
    Join Date
    Dec 2008
    Posts
    31

    Default

    Is there a way to unzip a file using some CPanel or Perl Modules in a PHP file

  9. #39
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by rongup View Post
    Is there a way to unzip a file using some CPanel or Perl Modules in a PHP file
    That functionality isn't part of API1 or API2, so you'll need to rely on the programming language you are using to handle that for you.

Similar Threads & Tags
Similar threads

  1. Delete Files/Dirs - API1 and/or API2
    By adelin.feraru in forum cPanel Developers
    Replies: 2
    Last Post: 11-17-2010, 11:00 AM
  2. addforward aPI1 bad args in documentation
    By jcorreia in forum cPanel Developers
    Replies: 2
    Last Post: 03-02-2010, 04:26 AM
  3. XML-API issues with API1 and API2 commands
    By XenomediaBV in forum cPanel Developers
    Replies: 7
    Last Post: 09-14-2009, 11:34 AM
  4. API1 doc?
    By takabanana in forum cPanel Developers
    Replies: 1
    Last Post: 05-20-2009, 04:23 PM
  5. List of all available API1 and API2 modules
    By ck in forum cPanel Developers
    Replies: 1
    Last Post: 04-27-2009, 10:43 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube