[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

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


Closed Thread
 
LinkBack Thread Tools
Old 02-13-2006, 08:40 AM   #1 (permalink)
NamePros Member
 
Join Date: Mar 2005
Posts: 33
53.00 NP$ (Donate)

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.

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, 09:21 AM   #2 (permalink)
Pro Coder & Designer
 
xlusive's Avatar
 
Join Date: Apr 2005
Location: Netherlands
Posts: 964
101.50 NP$ (Donate)

xlusive is just really nicexlusive is just really nicexlusive is just really nicexlusive is just really nicexlusive 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!
__________________
Online Dragonball Game
xlusive is offline  
Old 02-13-2006, 09:27 AM   #3 (permalink)
Senior Member
 
Join Date: Mar 2004
Posts: 1,404
2,705.50 NP$ (Donate)

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, 04:38 PM   #4 (permalink)
NamePros Member
 
Join Date: Feb 2006
Location: Online
Posts: 111
100.80 NP$ (Donate)

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, 04:03 AM   #5 (permalink)
Senior Member
 
Join Date: Mar 2004
Posts: 1,404
2,705.50 NP$ (Donate)

primacomputer is a jewel in the roughprimacomputer is a jewel in the roughprimacomputer is a jewel in the rough


Quote:
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, 05:49 AM   #6 (permalink)
dre
NamePros Regular
 
Join Date: Jul 2005
Posts: 593
98.85 NP$ (Donate)

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"-->
Let me know if it works
dre is offline  
Old 02-14-2006, 10:45 PM   #7 (permalink)
NamePros Regular
 
Join Date: Jul 2005
Location: Vancouver
Posts: 530
122.65 NP$ (Donate)

shadow_boi is a jewel in the roughshadow_boi is a jewel in the roughshadow_boi is a jewel in the rough


Quote:
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
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, 12:13 AM   #8 (permalink)
Senior Member
 
Join Date: Mar 2004
Posts: 1,404
2,705.50 NP$ (Donate)

primacomputer is a jewel in the roughprimacomputer is a jewel in the roughprimacomputer is a jewel in the rough


Quote:
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.

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, 06:20 AM   #9 (permalink)
NamePros Member
 
Join Date: Mar 2005
Posts: 33
53.00 NP$ (Donate)

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?
FreeBaGeL is offline  
Old 02-21-2006, 06:36 AM   #10 (permalink)
tgo
NamePros Regular
 
Join Date: Aug 2005
Posts: 317
103.75 NP$ (Donate)

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, 08:22 AM   #11 (permalink)
Senior Member
 
Join Date: Mar 2004
Posts: 1,404
2,705.50 NP$ (Donate)

primacomputer is a jewel in the roughprimacomputer is a jewel in the roughprimacomputer is a jewel in the rough


Quote:
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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


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

Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 03:54 PM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85