Support forums
in

GetWebPath() is Outputting a bad URL, Server has Real Path and Alias in Use

Last post 08-29-2013, 3:52 AM by stoi2m1. 3 replies.
Sort Posts: Previous Next
  •  08-26-2013, 5:21 AM 77902

    GetWebPath() is Outputting a bad URL, Server has Real Path and Alias in Use

    Im having some issues with GetWebPath(). Seems My host recently migrated my hosting account to a new/upgraded server. Now my uploader is not working. The host had little to no help on this issue. So I made some mods to the function to make it work for me. Maybe you have a better more full proof solution. Seems I have an alias in use sometimes. Actual real root path is /home3/user/. Alias is /home/user/.

    Here are some variable dumps: 

    $pfile = /home3/user/public_html/www2/wp-content/mu-plugins/track-management/trackuploader/phpuploader/include_phpuploader.php
    $_SERVER['SCRIPT_FILENAME'] = /home/user/public_html/www2/wp-admin/admin.php
    $_SERVER['ORIG_SCRIPT_FILENAME'] = NULL 
    $scriptfile = /home/user/public_html/www2/wp-admin/admin.php
    __FILE__ = /home3/user/public_html/www2/wp-content/mu-plugins/track-management/trackuploader/phpuploader/include_phpuploader.php
    $vpath = /wp-admin/admin.php
    the output url of getwebpath is http://domain.com/wp-admin/3/user/public_html/wp-content/mu-plugins/track-management/trackuploader/phpuploader/ajaxuploaderresource.php?type=file&file=continuous.gif 
    realpath($_SERVER['SCRIPT_FILENAME']) = /home3/user/public_html/www2/wp-admin/admin.php 
    after wrapping the realpath($_SERVER['SCRIPT_FILENAME']) 
    my output changed to http://domain.com/wpcontent/mu-plugins/track-management/trackuploader/phpuploader/ajaxuploaderresource.php?type=file&file=continuous.gif (removnig the hyphen from wp-content, so i hacked it up to make the output what i needed, by using str_replace).
    Hopefully you can improve the function to be a bit more full proof. I can test things if you need me to I have a deveopment server in the same environment.

    Thanks,

    Jesse 

  •  08-26-2013, 12:55 PM 77913 in reply to 77902

    Re: GetWebPath() is Outputting a bad URL, Server has Real Path and Alias in Use

    Hi stoi2m1,

     

    Please try the way below, it should fix this problem.

     

    1. open file \phpuploader\include_phpuploader.php


    2. find section below


    $cd=dirname($this->GetWebPath(__FILE__));


    3. change it to


    $cd=dirname($_SERVER['SCRIPT_NAME']).'/phpuploader';

     
    Regards,
     
    Ken
     

  •  08-26-2013, 3:53 PM 77917 in reply to 77913

    Re: GetWebPath() is Outputting a bad URL, Server has Real Path and Alias in Use

    the  server global output for script name is:
    $_SERVER['SCRIPT_NAME'] = /wp-admin/admin.php
    the output url is:
    http://domain.com/wp-admin/phpuploader/ajaxuploaderresource.php?type=script
    Which is not correct. The correct path is doamin.com/wp-content/mu-plugins/phpuploader 

    I do have things working on my production server, but it is not a full proof solution, I will test any other methods you would like or I canlook at this more when I have resolved some other issues my host has caused with this migration/upgrade they have done to me hosting.

     

    Thanks,

    Jesse 

  •  08-29-2013, 3:52 AM 77930 in reply to 77917

    [Closed] Re: GetWebPath() is Outputting a bad URL, Server has Real Path and Alias in Use

    Well I wrote a script and used the phpinfo function to show my host what was going on and they finally fixed things for me.

     

    Thanks for the Assistance,

    jesse 

View as RSS news feed in XML
Powered by Community Server (Commercial Edition), by Telligent Systems