Jump to content

Search the Community

Showing results for 'phps'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General Discussion
    • Website Management and Coding
    • Technology and the Internet
    • Philosophy, Politics, and Science
    • Art and Entertainment
    • Other Discussion
  • HelioHost
    • Questions
    • Customer Service
    • How You Can Help
  • HelioNet
    • News
    • Contact HelioNet

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 11 results

  1. tldr; I'd like to add an `.htaccess` rule to rewrite `*.phps` URLs to their actual `.php` source document, but instruct FastCGI to syntax highlight and render the source file as HTML instead of interpreting it. Some due diligence: I searched the forums for: "phps" (Old thread from 2009 about bypassing apache/suPHP configs and highlighting via `RewriteRule /highlight.php?file=$1`.) "fastcgi" (Nothing obviously php/fastcgi/htaccess related.) "fcgi" (Nothing obviously php/fastcgi/htaccess related.) "handler" (There's an old thread about telling apache to process `.pro` files as PHP.) "htaccess" (Nothing obviously php/fastcgi/htaccess related.) etc. I searched the wiki. I've done loads of Google searches similar to the above, and read dozens of StackOverflow QAs. I've browsed the Plesk docs, but they don't get to the level of config file detail. I've tried adding a `SetHandler fcgid-script` (among many others) in my `.htaccess`. I've experimented with a bunch of stuff in my Heliohost Marty space. General info: Morty username: beporter Site: https://gravatar.redirect.channel PHP file URL: https://gravatar.redirect.channel/gravatarizer.php (On its own, configured to bounce invalid requests back to the homepage.) Desired .phps URL: https://gravatar.redirect.channel/gravatarizer.phps (should render html version of the source code for the `.php` version of the same filename.) I tried symlinking this in git, but: the Plesk logs say I can't use `<Directory>` which means I can't use `Options FollowSymlinks` either. According to the Plesk file browser, git doesn't push the symlink over SFTP, at least not with the Github Action I've been using. Example non-functional `.htaccess` rules: # Allow PHP source code to render as text for inspection AddType application/x-httpd-php-source .phps # RewriteRule ^(.+\.php)s$ $1 [H=application/x-httpd-php-source] # --or-- # RewriteRule ^(.+\.php)s$ $1 [H=php-script] # Allow examining .phps files. # <FilesMatch "\.phps$"> # SetHandler application/x-httpd-php-source # </FilesMatch> If this were `mod_php` in Apache, I suspect that first commented-out RewriteRule would have been sufficient. But since PHP files are passed through to FasgCGI, it seems like that Apache handler isn't recognized or responding. What I can't find is documentation on how Heliohost has named its PHP handlers. I found a support page about using the plesk cli tool, but obviously I can't run that myself. It's totally fine if this is outside the realm of possibility, but since this whole single-page-site is meant to be a learning experience, it'd be nice to get this working in the`.htaccess`, if possible. Thanks for your time!
  2. I just did some research on this, and even ignoring the "Why?" aspect of this, the behavior of .phps (colorized source view) is apparently a function specifically provided by the mod_php module for apache. It's not a function of PHP itself. Since Plesk does not use the apache module, this isn't supported. Your best bet is going to be a solution like Krydos suggested: Write a PHP script that displays another script's contents. Once you have that, you can probably be creative with .htaccess rewrite rules to make calls for .phps files redirect to that script with the requested file as a parameter to emulate the behavior.
  3. If your lke me, sometimes you need to show the source of your php script. You can highlight (color code) your php code with the highlight_file() function. By using the .phps extension you can just make a copy of the php file and then rename it with the phps extension like below: Working file: http://helio.byrondallas.heliohost.org/server_load_s.gif Highlighted file: http://helio.byrondallas.heliohost.org/server_load_s.phps First create a file named phpsource.php in your root directory and add the code below: <?php if (substr($_GET['file'],strpos($_GET['file'],'.')) == '.phps') { highlight_file($_GET['file']); } ?> Then add these two lines to your root .htaccess file: RewriteEngine On RewriteRule ^(.+.phps)$ phpsource.php?file=$1 [L] Now you can show the source of any php file by adding the .phps extension. There's also another way which I use more often and that's using the highlight_string() function. <?php highlight_string('YOUR PHP CODE HERE'); ?> I normally just add that to the bottom of an example page, like the example below: http://helio.byrondallas.heliohost.org/email_form.php Just remember if you use single quotes to wrap your code in, you'll need backslash ALL single quotes inside your code \'. Same way if you use double quotes to wrap your code in, then you'll need to backslash ALL of the double quotes in your code \".
  4. Since you're trying to connect to Gmail you have to use xoauth as they recently disabled simple password authentication. Check out https://github.com/PHPMailer/PHPMailer/blob/master/examples/gmail_xoauth.phps
  5. I have gallery folder that have foto folder to store file from gallery uploader. But i cant acces file in foto folder cause .htacces code inside foto folder to prevent file uploader not suitable for heliohost.org hosting. The script code .htaccess like this RemoveHandler .php .phtml .php3 .php4 .php5 .php6 .phps .cgi .exe .pl .asp .aspx .shtml .shtm .fcgi .fpl .jsp .py AddType application/x-httpd-php-source .php .phtml .php3 .php4 .php5 .php6 .phps .cgi .exe .pl .asp .aspx .shtml .shtm .fcgi .fpl .jsp .py php_flag engine 0[/code] I think code inside .htaccess file not suitable for heliohost.org hosting and i got 403 error message, how to change that code to match with heliohost.org hosting. Thanks
  6. Seems the syntax-highlighting is working just not with the .phps <?php highlight_file('analog-clock.php'); ?> http://byrondallas.heliohost.org/php/php-highlight_file.php It's not that big of a deal (.phps) since I can use that function if I want to color code my php and there's also a function to highlight just a string of code. highlight_string(''); It was just a little easier to add the s to the file name and resave it that way.
  7. I tried both the AddType and the AdHandler and neither one nor both together worked for me either. AddType application/x-httpd-php .pro AddHandler application/x-httpd-php .pro I Also noticed awhile back that the .phps extention doesn't work either and the mime type is already there by default in the MIME Types. http://byrondallas.heliohost.org/php/countdown.phps Maybe djbob will look into this?
  8. Ever wanted to annotate an image on your web site, maybe with random text or a countdown? With the Imagick Class it's really simple. Just copy and paste the code below into a php file and then add the php file inside an image tag: <?php # Define countdown, if your using a countdown $day = 7; $month = 7; $year = 2012; $days = (int)((mktime (0,0,0,$month,$day,$year) - time(void))/86400); $days = $days+1; # Your image goes here, relative path $image = new Imagick("../images/seaside.jpg"); $draw = new ImagickDraw(); /* The $x and $y attributes and the text that's displayed. The $x and $y attributes are for moving the text from the left or top by pixels after setting the gravity. */ $x = 0; # pixels from the left $y = 30; # pixels from the top $text = "$days days til Vacation!"; # The font and font attributes $draw->setFont("Times-Italic"); $draw->setFontSize(40); $draw->setFillColor("white"); $draw->setStrokeColor("white"); $draw->setStrokeWidth(0.5); $draw->setGravity(Imagick::GRAVITY_NORTH); $image->annotateImage($draw, $x, $y, 0, $text); /* Other gravity settings Imagick::GRAVITY_NORTHWEST Imagick::GRAVITY_NORTH Imagick::GRAVITY_NORTHEAST Imagick::GRAVITY_WEST Imagick::GRAVITY_CENTER Imagick::GRAVITY_EAST Imagick::GRAVITY_SOUTHWEST Imagick::GRAVITY_SOUTH Imagick::GRAVITY_SOUTHEAST */ # Make headers header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); header("Content-type: image/jpeg"); echo $image; ?> The finished image: http://byrondallas.heliohost.org/php/countdown-imagick.php Highlighted code: http://byrondallas.heliohost.org/php/countdown-imagick.phps Use an <img> tag to code it on your page: <img src="http://byrondallas.heliohost.org/php/countdown-imagick.php" width="384" height="288" border="0"> Server fonts to choose from: http://byrondallas.heliohost.org/php/tools...font-viewer.php Of if you choose to use a True Type Font, you can replace this line with the relative path to your font: $draw->setFont("fonts/my-font.ttf");
  9. I just went back and looked at that hack again and they're using the same function too. highlight_file(); I might just add that to my site so I can use .phps
  10. When I add a x-httpd-php5-source handler and try to point .phps files to the that handler, I get a strange error that turns up nothing in Google ("Handler application/x-httpd-php5-source not found"). Except if I actually enter a Handler it doesn't know, Apache should (and does) just ignore it. Look like syntax-highlighting is poorly implementing in suPHP. I recommend trying this hack to get around the issue (the FAQ they source is outdated to show that suPHP can't handle syntax highlighting is outdated, though; suPHP claims it is supported as of version 0.7.0).
  11. Works for me: http://byrondallas.heliohost.org/hello_world.pro What about the .phps extension to show color coded php code? Did you find anything out about it?
×
×
  • Create New...