Unstoppable Domains

Embed PHP in an ASP page...possible?

Spaceship Spaceship
Watch

FreeBaGeL

Established Member
Impact
2
Ok, here's the deal. At work I was asked to take ownership of the updates to a website written in ASP.net with an MSAccess (puke) backend. I, however, don't know ASP.net. Simple updates have been easy enough, but have recently been asked by the client to add a form that will need to write to the database and then return an amount.

I know PHP pretty well, and would be able to complete this task much quicker if I can use PHP. Is it possible for me to just embed the PHP code for this within an ASP page (that hence would not have a .php extension)?

I would just try it out myself but this is a home project and I am currently at work and need to give my boss an answer by the end of the day. I have been unable to find anything about embedding php code in an asp page on google.

Thanks in advance.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
ASP and PHP dont work together well. I dont think its possible. So you need to rewrite the database and pages in to php or learn ASP for dummies real real fast!
 
0
•••
I heard rumours once that you could use the language= setting in a <script> tag to get PHP to execute in an ASP page like you can with PerlScript. But I have never seen it in action and it does not work on any of my windows boxes that have PHP installed.

If your familiar with SQL you can learn everything you need to about using an Access database through ADO in 30 minutes. That's probably the best way to go,

If you're really dead set on using PHP you can always do the database pages in PHP and stick them in a frame/layer/iframe/whatever on your ASP page.
 
0
•••
Blahblah and such. ASP.net is nothing like the classic scripting language ASP. Whilst ASP and PHP are much alike ASP.NET (or VB.NET if you like) and PHP is like apples and oranges. Parsing of PHP (and ASP for that matter) is based on extensions (php or asp) regged within the webservers' settings (apache or IIS). So writing code in VB.NET and putting <?php?> tags in it is just erhm... Wishful thinking, to say the least :)

I'm sorry but you've got to make up your mind about what language you're going to develop in ;)
 
0
•••
BartMSX said:
So writing code in VB.NET and putting <?php?> tags in it is just erhm... Wishful thinking, to say the least :)
This is one of the unfortunate limitations of PHP. That's why real men code in perl where you can not only mix it in with VB but write the entire script in one 500 character long line that takes a team of engineers to decipher and outputs โ€œjust another perl hackerโ€ when played backwards :)
 
0
•••
Do this... it should work.... make the php page you want to display in the asp page, use the code below to include into the file into the asp page.

PHP:
<!--#include virtual="/path/to/phpfile.php"-->

Let me know if it works
 
0
•••
dre said:
Do this... it should work.... make the php page you want to display in the asp page, use the code below to include into the file into the asp page.

PHP:
<!--#include virtual="/path/to/phpfile.php"-->

Let me know if it works

But the file would have a .php extension, right?

Didnt he say he didnt want to have .php file?
 
0
•••
dre said:
Do this... it should work.... make the php page you want to display in the asp page, use the code below to include into the file into the asp page.

PHP:
<!--#include virtual="/path/to/phpfile.php"-->

Let me know if it works
That won't work. It will simply include the data in that file as if he had copied and pasted it. It won't run the script.

One thing he could do is create an ASP wrapper for a PHP page using XMLHTTP or something of the sort. The user would access an ASP page. The ASP page would POST/GET the relevant data to the PHP page and output the results to the user.

A lot more work than a 30 minute crash course in ASP, but it would allow him to code in PHP and give the appearance of it being ASP.
 
0
•••
Yeah I'll likely just end up using ASP if embedding the PHP is going to be a big deal, was just looking for that as a time-saver over learning ASP.

Here's a question though, can I have multiple pages on the same website connect to the same database in different programming languages?

For instance, if most of the website is written in ASP and pulls info from the database, can I make a .php page on the same website that writes to and reads from that same database?
 
0
•••
I just added a Iframe when I needed to use PHP in an asp page. It worked but it still requires a php extention page.

http://seohelp.info/webspeedtest.asp

No way otherwize, trust me I tried.
 
0
•••
FreeBaGeL said:
Yeah I'll likely just end up using ASP if embedding the PHP is going to be a big deal, was just looking for that as a time-saver over learning ASP.

Here's a question though, can I have multiple pages on the same website connect to the same database in different programming languages?

For instance, if most of the website is written in ASP and pulls info from the database, can I make a .php page on the same website that writes to and reads from that same database?
Assuming your using some sort of database server (ie SQL) or driver that supports concurrent access on a file (ie ODBC with Access) this in no problem. In fact you can access databases from multiple machines, multiple virtual servers, and multiple scripting languages all at the same time.
 
0
•••
Dynadot โ€” .com Registration $8.99Dynadot โ€” .com Registration $8.99
Unstoppable Domains
Domain Recover
DomainEasy โ€” Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back