homepage Welcome to WebmasterWorld Guest from 54.242.18.190
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
Forum Library, Charter, Moderators: coopster & jatar k & phranque

Perl Server Side CGI Scripting Forum

This 58 message thread spans 2 pages: < < 58 ( 1 [2]     
Putting a new dynamic PHP/MySQL site on a cd-rom
Any technology available to make dynamic access possible?
louponne




msg:437824
 1:22 pm on Dec 10, 2002 (gmt 0)

I have a dynamic site using PHP/MySQL that I now need to put on a cd-rom. It's basically an informational site, with about 1000 records of info, and several ways to query them. Of course I could hard-code a certain number of queries and query-responses and put a few hundred static .htm pages on the cd to run the queries and responses-to-queries and work it that way, but that would both make for a lot of work, and limit the cross-criteria queries quite a bit.

Any other way to do it without getting into a mega-budget?

 

louponne




msg:437854
 12:09 am on Dec 18, 2002 (gmt 0)

hmm... start.html starts, but nothing else. I'm getting a page not found now. I assume that the same change 8181->8182 should be made in start.html, right?

andreasfriedrich




msg:437855
 12:12 am on Dec 18, 2002 (gmt 0)

No. 8181 is the port Apache listens on, 8182 is the port MySQL listens on.

In start.html we tell the browser which web server it should use. In index.php we tell PHP which mysql server to use.

Did you change anything else or just the two files?

Andreas

louponne




msg:437856
 12:16 am on Dec 18, 2002 (gmt 0)

No, just those two files!

andreasfriedrich




msg:437857
 12:28 am on Dec 18, 2002 (gmt 0)

You might want to check whether any server (apache or mysql) is still running from the previous try.

To shutdown Apache just close the console window it is running in. To shutdown the mysql server run mysqladmin --port=8182 shutdown.

To help isolate the error run each of the three commands at the bottom of start.pl separately.

start MySQL/bin/mysqld-opt.exe --skip-innodb --port=8182

check whether you can access the server with

mysql --port=8182 -u apache -p ba

and enter the password aaron/8 when prompted.

start Apache/Apache.exe -f $tmp/Apache/httpd.conf

You need to substitute $tmp with the path to your temp directory.

Does apache start?

If everything seems ok so far open start.htm

Andreas

BTW if you do not manage to get it working I´ll have access to Win2000 and Win98 boxes over X-mas and will certain check out whether they work on those.

louponne




msg:437858
 12:40 am on Dec 18, 2002 (gmt 0)

> You might want to check whether any server (apache or mysql) is still running from the previous try.

Well, when I boot up, I can see via the Win2000 Task Manager that I automatically have two apache.exe running and also mysqld-nt.exe

> To shutdown Apache just close the console window it is running in.

um, what console window?

> To shutdown the mysql server run mysqladmin --port=8182 shutdown.

sorry, but where do I type that?

> start MySQL/bin/mysqld-opt.exe --skip-innodb --port=8182

I executed that, and see via the Task Manager that now mysld-opt.exe is running (it wasn't before)

> check whether you can access the server with
> mysql --port=8182 -u apache -p ba

sorry again, but where do I type that?

> start Apache/Apache.exe -f $tmp/Apache/httpd.conf
> You need to substitute $tmp with the path to your temp directory.
> Does apache start?

Isn't there going to be a conflict with the apache that I already have running at bootup?

louponne




msg:437859
 12:41 am on Dec 18, 2002 (gmt 0)

I have just been able to screen-capture the fleeting window that opens when the cd autoruns. It says :
E:\>perl2\perl.exe start.pl
C:\path_to_my_temp_folder

And then it almost immediately closes

andreasfriedrich




msg:437860
 12:51 am on Dec 18, 2002 (gmt 0)

>Well, when I boot up, I can see via the Win2000 Task Manager that I automatically have two apache.exe running and also mysqld-nt.exe

Good. Those are the ones running from your harddrive.

>> To shutdown Apache just close the console window it is running in.

>um, what console window?

After you boot your computer there won´t be one. But the Apache instance that gets started from the CD will run in a console window. It will pop up when the perl script starts Apache. To shut down that Apache instance all you need to do is close the window.

>> To shutdown the mysql server run mysqladmin --port=8182 shutdown.

>sorry, but where do I type that?

You will only need to do that when the task manager shows a mysqld-opt process. If it does dir into e:\mysql\bin and execute the command from there.

>> start MySQL/bin/mysqld-opt.exe --skip-innodb --port=8182

>I executed that, and see via the Task Manager that now mysld-opt.exe is running (it wasn't before)

That´s great!

>> check whether you can access the server with
>> mysql --port=8182 -u apache -p ba

>sorry again, but where do I type that?

Dir into e:\mysql\bin and execute the command from there. But you probably do not need to do that. If mysld-opt.exe is running this should be ok.

>> start Apache/Apache.exe -f $tmp/Apache/httpd.conf
>> You need to substitute $tmp with the path to your temp directory.
>> Does apache start?

>Isn't there going to be a conflict with the apache that I already have running at bootup?

No. With Apache I took the precausion of configuring the Apache instance that runs from CD to listen on the non-standard port 8181. You are right though. If I hadn´t changed the port there would have been a conflict. Just as there has been a conflict between the two MySQL servers.

Do start Apache as explained and then open start.htm.

Hopefully it will work. If it does we can work on getting it to run from the perl script again.

Andreas

louponne




msg:437861
 1:16 am on Dec 18, 2002 (gmt 0)

> After you boot your computer there won´t be one. But the Apache instance that gets started from the CD will run in a console window. It will pop up when the perl script starts Apache.

ok - well, I don't get that console window, so i guess that means that the perl script is not able to start up apache?

> If mysld-opt.exe is running this should be ok.

ok, then I have just left mysql as is - I see that mysqld-opt.exe is indeed running.

>> start Apache/Apache.exe -f $tmp/Apache/httpd.conf
>> You need to substitute $tmp with the path to your temp directory.
>> Does apache start?

Yes, I have just started up apache from the cd as you explained - the cd hums, and I see two new apache.exe show up in the win2000 Task Manager.

But, FYI, I do not get a "console" window.

Now, if I open start.html, as soon as it tries to go to [localhost:8181...] I get the previous error :
Error: Couldn´t connect to MySQL server localhost:8182.
Warning: Access denied for user: 'ODBC@localhost' (Using password: NO) in e:\htdocs\index.php on line 20
Warning: MySQL Connection Failed: Access denied for user: 'ODBC@localhost' (Using password: NO) in e:\htdocs\index.php on line 20

FWIW, I ran the MySqlManager.exe from the cd, and it shows my hard-drive mysql databases only.

Sorry, but I'm signed off at this point Andreas - around 2AM, things just get a bit to bleary for me! See you tomorrow if you're still game!

Thanks thus far and ... good night!

louponne




msg:437862
 1:18 am on Dec 18, 2002 (gmt 0)

hmm.. I just noticed that when I close the DOS window where I ran the apache.exe command, those two new instances of apache.exe disappeared from the Task Manager - so I guess maybe that was what you called a "console" after all!

andreasfriedrich




msg:437863
 1:23 am on Dec 18, 2002 (gmt 0)

Good night louponne. I´ll head to bed as well.

Yes that was the console window. ;)

Andreas

trismegisto




msg:437864
 1:37 pm on Dec 18, 2002 (gmt 0)

andreas, i’ll be posting feedback as soon as i can, certainly on friday or saturday. now i’m using mac os x and currently don’t have available a windows machine in which i could test your CD… once you finish with the windows version, could you post a linux one? :)

louponne




msg:437865
 2:22 pm on Dec 18, 2002 (gmt 0)

I'll be ready to continue testing again this eve, Andreas - for now, I have to work at my job! :-)

andreasfriedrich




msg:437866
 2:58 pm on Dec 18, 2002 (gmt 0)

I´ll be there louponne. I believe I know what´s causing the error.

As promised there will be a linux version trismegisto.

Andreas

richardb




msg:437867
 3:18 pm on Dec 18, 2002 (gmt 0)

Lovely thread folks!

Has anyone done anything similar with Access or SQL server, asp and PWS or IIS?

Be intersetd to hear about it don't worry about the copyright distribution aspect, gave me an idea for demos...

Rich

ruserious




msg:437868
 6:23 pm on Dec 18, 2002 (gmt 0)

Hi andreas,

for debugging I just used

Subst H: C:\my_path_to_the_folder

for not toasting too many cds ;)

I then started the .pl script and mysql-daemon and apache started.

However I got errors so I tried to connect to the db manually on the command line and got the response that user/pass is not correct.

I had downloaded your first version of the zip and then copied over the two files from you later start.zip (in their appriate directories of course ;)). I am using winXP.

So everything seems fine, except that user/pass are wrong (apache and aaron/8).

Thanks for your scripts and effort. :)

andreasfriedrich




msg:437869
 6:25 pm on Dec 18, 2002 (gmt 0)

With those MS products there is the problem that you would need to make changes to the registry. While this could be done very easily from a script it is hard to tell whether the changes will break any other settings on the computer.

Especially if you run the CD on a client´s computer it is rather bad if you break their windows installation. With a WAMP system there are no such worries since they use configuration files.

Andreas

andreasfriedrich




msg:437870
 6:33 pm on Dec 18, 2002 (gmt 0)

So everything seems fine, except that user/pass are wrong (apache and aaron/8).

Did you manage to fix that?

If you have another instance of mysqld already running this error indicates that index.php might try to access this old instance instead of the one started from CD.

The second version addresses this problem by having mysqld listening on port 8182 and preventing it from reading any mysql configuration files that may already be on your box. To get the second version either download the complete zip file amp_win­dows_0.2.­zip or the update amp_up­da­te_12182002.­zip. To apply the update simply unzip it and copy the directory tree over the old one.

Andreas

ruserious




msg:437871
 6:55 pm on Dec 18, 2002 (gmt 0)

Ok now I started mysql with:

(G being my virtual drive)
G:\MySQL\bin>start G:/MySQL/bin/mysqld-opt.exe --skip-innodb --port=8182 --skip-grant-tables

and connected as root. To my surprise it showed me the tables from my own local db, which resides in a totally different directory. I carefully closed down all mysql-instances and tried again, it will start the binary from the cd, but it uses my own local-db installation [data, that is].

Any ideas?

andreasfriedrich




msg:437872
 7:22 pm on Dec 18, 2002 (gmt 0)

mysqld tries to be really smart and looks for configuration files that are already on your disk. If you run G:/MySQL/bin/mysqld-opt.exe --help it will tell you where it looks for those files.

As I wrote above, the second version fixes that behaviour. To get that second version from the first one you downloaded simply download both updates [ecotur.de] and apply them in the order they are listed on the website.

This should help.

Andreas

ruserious




msg:437873
 7:24 pm on Dec 18, 2002 (gmt 0)

Using the option

--datadir=G:/MySQL/data

helped. So I fixed your start.pl script by replacing

system "start MySQL/bin/mysqld-opt.exe --skip-innodb --port=8182";

with

system "start MySQL/bin/mysqld-opt.exe --skip-innodb --port=8182 --datadir=$cwd/MySQL/data";

Everthings working pretty now. :)

Just one question: Any idea on how to make a batch-file that closes both the apache and the mysql-server running?

EDIT: Ah, ok. Guess I am running around blindfold, I did not see the link earlier, I only saw the download-link to start.zip. Anways I saw you already added a stop script, so I guess everythings ok now. :) (<-- happy me)

Thanks!

[edited by: ruserious at 7:27 pm (utc) on Dec. 18, 2002]

andreasfriedrich




msg:437874
 7:24 pm on Dec 18, 2002 (gmt 0)

BTW sorry about the number of updates. I´m not trying to compete with MS ;) but I simply do not have the time for extensive testing.

Andreas

andreasfriedrich




msg:437875
 7:26 pm on Dec 18, 2002 (gmt 0)

You´ll find a stop.bat and stop.pl file in the first update. To get it to work properly you need the second update as well ;)

Andreas

andreasfriedrich




msg:437876
 7:29 pm on Dec 18, 2002 (gmt 0)

Using --datadir=G:/MySQL/data addresses just one problem. There is the temp and base directory as well. Those will still be taken from the configuration files that are already on your disk.

To prevent mysqld from using them altogether you need to use --defaults-file=path/to/my.ini. This is the way mysql gets started in the second version.

Andreas

ruserious




msg:437877
 7:40 pm on Dec 18, 2002 (gmt 0)

Danke schön! Funktioniert alles prima jetzt. :)
(=> thanks, everything working great now)

andreasfriedrich




msg:437878
 7:52 pm on Dec 18, 2002 (gmt 0)

Das freut mich.

Andreas

louponne




msg:437879
 10:13 pm on Dec 18, 2002 (gmt 0)

All's working great for me too! :-))
Merci beaucoup, Andreas! Hats off to you!

shady




msg:437880
 2:51 am on Dec 19, 2002 (gmt 0)

Never would have thought it possible. Thank you very much andreasfriedrich, very kind of you to setup this download for us.

andreasfriedrich




msg:437881
 8:47 pm on Jan 9, 2003 (gmt 0)

New version

There is a new AMP on CD version [x-author.de] available. If you need only the scripts there is a smaller download available as well.

Changes

  • Ad­ded sup­port for wri­ta­ble da­ta­ba­ses: When you put an empty file into the CD´s root directory and name it database.writable the database will be copied to the temporary directory in the HD.
  • ph­p.i­ni is con­fi­gu­ra­ble as well. The di­rec­to­ry to sto­re PHP ses­si­ons is set to %%LOGS%%.
  • Start script hand­les ca­ses whe­re user did not shut down the sy­stem pro­per­ly.
  • Added a bit of documentation.
  • Changed the directory structure a bit: Databases go into the \database directory, Webdocuments go into \htdocs and all configuration files are in the \conf directory.

Andreas

This 58 message thread spans 2 pages: < < 58 ( 1 [2]
Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved