-1

I'm interested in generating dynamic SVG images using PHP. Can I accomplish this without switching to the ".php" file extension for the source document? Can the source document have an ".svg" extension?

This tutorial seems to imply that the file must have an ".php" extension.

http://www.devx.com/webdev/Article/37004

posfan12
  • 2,541
  • 8
  • 35
  • 57
  • 1
    Possible duplicate of [Is it possible to execute PHP with extension file.php.jpg?](http://stackoverflow.com/questions/8025236/is-it-possible-to-execute-php-with-extension-file-php-jpg) – approxiblue Dec 26 '16 at 19:16

1 Answers1

1

The actual (on the disk) php file must have .php extension. This is required for it to be properly executed.

However, that doesn't mean that you have to use the file's filename in order to access it over the web. In Apache2 server, this is done using mod_rewrite. Read about it here.

Example (taken from article):

http://example.com/user.php?id=AHHHHHH

http://example.com/user/AHHHHHH

Same way you can use it to "hide" dynamic_svg.php and make the url dynamic.svg

P.S. I used Apache2 as example, because it's the most popular server. Other web servers (nginx, IIS) have their own way of accomplishing this

Xymanek
  • 1,357
  • 14
  • 25