Jump to content

Run PHP with a webserver?!


matstuff

Recommended Posts

Hi,

 

I'd like to install PHP to run on my local machine, such that if I open a file in Firefox etc., it runs the script and outputs the HTML correctly. *However*, is there any way of doing this without having to install a webserver? I'm using a machine in a University network with [understandably] somewhat restrictive policies - i.e. I can't run a webserver! However, I need to write an interface for MySQL, and VB Express is shite!

 

Any suggestions would be much appreciated.

 

Cheers,

 

Mat

Link to comment
Share on other sites

No, in a word.

In order for the PHP parser to work it needs to be installed, and thus you also need a webserver (most commonly apache) to process the service request and send it to the Zend engine.

 

So opening up a file in the browser will not work, it will merely read the text that is contained within that file.

Link to comment
Share on other sites

You will need some kind of parsing engine

 

Even specified programs often need apache etc running in the background to parse off and output

 

I think your screwed, unless there is some kind of all in one program, I've never heard of one, and if there is, what are the chances of installing it on network pc?

 

What I would do, and this is more advice than solution to original query, is set up apache etc on your computer at home, with ftp on it and work in uni but upload scripts to home PC

 

Thats what I used to do. Please tell me you have internet at home? :P

 

Or, bring your laptop in? (Assuming you have a laptop of course ;))

Link to comment
Share on other sites

I'm taking a stab in the dark here, but i'm guessing that you need to write this interface for a University project? Thus, I would imagine that the University would provide you with the tools for this job would they not? Or do they expect everyone to install/maintain/setup their own webservers? Thus I would guess they provide an IDE for you, which usually can be used to parse the code you're writing...

If it's not a Uni project (and thus you don't have the tools) then go home and do it. You can't install anything (because of policy) so it's not going to get any easier for you to do what you need.

Link to comment
Share on other sites

Bugger. Cheers guys. I suspected as much :(

 

No, it's not a project. It a database we need in our group. I was using Access, but for no reason that started crashing. I could obviously just use an online server - my ISP supports mysql and PHP, but the nature of the data means that it's sensitive enough not to be online. The crux of it is just being able to implement a GUI for the database (but not an Admin GUI)

 

Not to worry, thanks for your help.

 

Mat

Link to comment
Share on other sites

PHPMyAdmin is an excellent interface for MySQL (online). So should you ever decide that your data is safe on your web host (which it should be, so long as SQL User permissions have been set properly) then feel free to use this utility. It allows viewable data and you can execute queries against it should you need to. It isn't however a reporting tool, which is what you need I suspect.

Link to comment
Share on other sites

Like I said, I'm not after an administrative interface. I want something that will allow me to design a custom input form. PHPMyAdmin is good for setting up and administering the structure etc. of a database, but you can't give it to users to do things with.

Link to comment
Share on other sites

@matstuff

I would say you pick up one of the followings:

 

1. Ask university administrator for permission to install web server software (i.e. Apache)

2. By a webspace from hosting provider (about 100 USD/year can solve the problem perfectly).

3. Try searching if you can run Appache without installation (I tried googling but nothing good showed up)

Link to comment
Share on other sites

Its probably not really what you want, but you could use php cli to render your scripts into html then view the output in a browser.

 

It would seriously be a pain though.

 

You'd need two scripts. Once to render the pages.

 

render.php

#!/usr/bin/php
<?php

 if ($argc == 1) {
   ob_start();
   include $argv[1];
   file_put_contents('tmp.html',ob_get_clean());
 }

?>

 

And another to execute and then distroy.

 

view.php

#!/usr/bin/php
<?php

 if ($argc == 1) {
   exec("render.php {$argv[1]}");
   exec("/usr/bin/firefox file://tmp.html");
   exec("/bin/rm tmp.html");
 }

?>

 

Then all you would do is execute something like...

 

$ view.php mypage.php

 

None of this is at all tested, but it might give you some ideas.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.