NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Embed PHP in an ASP page...possible?

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 02-13-2006, 09:40 AM THREAD STARTER               #1 (permalink)
NamePros Member
Join Date: Mar 2005
Posts: 36
FreeBaGeL is an unknown quantity at this point
 



Embed PHP in an ASP page...possible?


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.
????: NamePros.com http://www.namepros.com/programming/167145-embed-php-in-asp-page-possible.html

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.
FreeBaGeL is offline  
Old 02-13-2006, 10:21 AM   #2 (permalink)
Pro Coder & Designer
 
aween's Avatar
Join Date: Apr 2005
Location: Netherlands
Posts: 967
aween is just really niceaween is just really niceaween is just really niceaween is just really niceaween is just really niceaween is just really niceaween is just really niceaween is just really nice
 



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!
__________________
aween web development
aween is offline  
Old 02-13-2006, 10:27 AM   #3 (permalink)
Senior Member
Join Date: Mar 2004
Posts: 1,402
primacomputer is a jewel in the roughprimacomputer is a jewel in the roughprimacomputer is a jewel in the rough
 



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.
primacomputer is offline  
Old 02-13-2006, 05:38 PM   #4 (permalink)
NamePros Member
Join Date: Feb 2006
Location: Online
Posts: 118
Barts has a spectacular aura aboutBarts has a spectacular aura about
 



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
Barts is offline  
Old 02-14-2006, 05:03 AM   #5 (permalink)
Senior Member
Join Date: Mar 2004
Posts: 1,402
primacomputer is a jewel in the roughprimacomputer is a jewel in the roughprimacomputer is a jewel in the rough
 



Originally Posted by BartMSX
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
primacomputer is offline  
Old 02-14-2006, 06:49 AM   #6 (permalink)
dre
NamePros Regular
Join Date: Jul 2005
Posts: 595
dre has a spectacular aura aboutdre has a spectacular aura about
 



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 Code:
<!--#include virtual="/path/to/phpfile.php"--> 
????: NamePros.com http://www.namepros.com/showthread.php?t=167145
Let me know if it works
dre is offline  
Old 02-14-2006, 11:45 PM   #7 (permalink)
NamePros Regular
Join Date: Jul 2005
Location: Vancouver
Posts: 533
shadow_boi is a jewel in the roughshadow_boi is a jewel in the roughshadow_boi is a jewel in the rough
 



Originally Posted by dre
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.
????: NamePros.com http://www.namepros.com/showthread.php?t=167145

PHP Code:
<!--#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?
shadow_boi is offline  
Old 02-15-2006, 01:13 AM   #8 (permalink)
Senior Member
Join Date: Mar 2004
Posts: 1,402
primacomputer is a jewel in the roughprimacomputer is a jewel in the roughprimacomputer is a jewel in the rough
 



Originally Posted by dre
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 Code:
<!--#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.
????: NamePros.com http://www.namepros.com/showthread.php?t=167145

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.
primacomputer is offline  
Old 02-21-2006, 07:20 AM THREAD STARTER               #9 (permalink)
NamePros Member
Join Date: Mar 2005
Posts: 36
FreeBaGeL is an unknown quantity at this point
 



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?
__________________
Looking forward to the Gears of War 3 Beta!
FreeBaGeL is offline  
Old 02-21-2006, 07:36 AM   #10 (permalink)
tgo
NamePros Regular
Join Date: Aug 2005
Posts: 315
tgo is on a distinguished road
 



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.
tgo is offline  
Old 02-21-2006, 09:22 AM   #11 (permalink)
Senior Member
Join Date: Mar 2004
Posts: 1,402
primacomputer is a jewel in the roughprimacomputer is a jewel in the roughprimacomputer is a jewel in the rough
 



Originally Posted by FreeBaGeL
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.
primacomputer is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP or ASP raju79 Web Design Reviews 8 12-14-2005 08:38 AM
NEW : Google AdSense(TM) Online Standard Terms and Conditions Mark Google Adsense 3 11-04-2005 01:37 PM
Good Article: An SEO Checklist Ferman Search Engines 2 05-28-2005 11:51 AM

Liquid Web Smart Servers  
All times are GMT -7. The time now is 06:00 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger