Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running PHP in Django

Tags:

django

Is there a way to run PHP scripts in django? I have a plugin in TinyMCE that runs PHP scripts, and it is able to work using XAMPP's Apache. However, Django does support running of PHP script and therefore the plugin is not able to work. I would like to know if there is a way to configure Django to run PHP scripts.

Any help or pointers appreciated. Many Thanks!

like image 726
XinYi Chua Avatar asked Sep 13 '12 16:09

XinYi Chua


People also ask

Can you run PHP with Django?

So, you need Python installed on your system and then install Django. All servers provide native support for PHP. So, if you have a server and a web browser you are good to go. You can learn more about the installation of PHP from their documentation.

Is PHP faster than Django?

Django facilitates faster and secure builds and frees the developer from mundane web development tasks, negating the need to create solutions from scratch. With multiple out-of-the-box features, it lets you create complete applications.

How do I run a PHP script?

php” file is placed inside the “htdocs” folder. If you want to run it, open any web browser and enter “localhost/demo. php” and press enter. Your program will run.

Can Python run PHP script?

You can simply execute the php executable from Python.


2 Answers

Django isn't a HTTP server. You need a HTTP server like Apache, Nginx, etc along with the correct php module to run your PHP script.

Then you can configure Django to run on the same server. Here's an howto for running Django with Apache https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/modwsgi/. Then you can configure your PHP script to run on the same server.

After that, how your PHP script interacts with Django project is implementation specific.

like image 187
mehulved Avatar answered Oct 22 '22 14:10

mehulved


Well, there's Django-php which lets you run PHP in Django templates - http://animuchan.net/django_php/

Though I'd draw your attention to the FAQ section of that website.

like image 32
moopet Avatar answered Oct 22 '22 15:10

moopet