Bundling with or inside WAMP
Posted by: timtak (---.c-able.ne.jp)
Date: October 29, 2006 07:22AM

Is it possible or difficult to bundle things inside WAMP5? I would like to bundle something in WAMP which would require the creation of a database and then to go to localhost at the end of the installation.

I guess that there must be software for the creation of windows installers and this request would in a sense put me in competition with WAMP5.

All the same would the phpteam be so kind as to tell us how they made the installer?

Perhaps the phpteam might be persuaded to make versions of WAMP5 that contain a few of the more famous OS php applications.

I am thinking of Moodle in particularly. It is a web application, but it helps to have a copy on ones desk top.

I see there is free software here for making installers
[www.jrsoftware.org]
perhaps I should ask there.

And I see that WAMP5 was created with INNO! and that there is an inno installation script at
[prdownloads.sourceforge.net]

It does not look easy!
Especially
1) where do the files go! I guess that one compiles the script when it is in the same directory as the sourve files (apache mysql etc)
2) creating a mysql database inside the inno script

I see tha there is a inno set up package unpacker
[innounp.sourceforge.net]
which will probably solve the first problem above, because it will be possible to see all the files and inno setup script in situe.

Perhaps it is possible to open up another moodle installer and see how the mysql database is set up.

Yes....it is all very exciting. But there are problems. The iss setup script is available at source forge but inside it the files to include in the installer are

Source: "D:\wampserver\install_files\close\*.*"; DestDir: "{app}\"; Flags: ignoreversion recursesubdirs deleteafterinstall;AfterInstall: close({app})
Source: "D:\wampserver\install_files\program\*.*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs;
Source: "D:\wampserver\install_files\local_root\*.*"; DestDir: "{app}\"; Flags: ignoreversion recursesubdirs onlyifdoesntexist;
Source: "D:\wampserver\install_files\mysql_ini\my.install"; DestDir: "{app}\mysql\"; Flags: ignoreversion;AfterInstall: myinifiles({app})
Source: "D:\wampserver\install_files\mysql\*.*"; DestDir: "{app}\mysql\"; Flags: ignoreversion recursesubdirs onlyifdoesntexist;

but these seem specific to Mr Romain Bourdon's computer and not all that easy to understand what each of the directories on his D drive contain.

If on the other hand one uses the installer unpacker "innounp.exe" to unpack WAMP5 then the install_script.iss is generated automatically and does not use wildcards. There is a very long list of files and some of hte flags are different.

I guess that each of the four folders in Mr. Bourdon's D drive correspond to file that need a different flag. I think that I may be able to work out where each of the files came from but it is not goign to be easy.

Is there any chance of telling us what each of the above folders on your D drive contains Mr. Bourdon?

The good news for me is, it seems that the moodle installers currently available (for older versions of Modle) are not creating a database (I think that the moodle installer does that) they are just calling the moodle installer using a bat file, which it it seems should be pretty easy to add to the list of bat files at the end of the wamp5.iss installation script. It should not be difficult to put moodleing into the www folder.

So I know how to do this in theory.

Timothy



Post Edited (10-29-06 11:10)

Options: ReplyQuote
Re: Bundling with or inside WAMP
Posted by: timtak (---.c-able.ne.jp)
Date: October 29, 2006 12:49PM

Sorry there were five folders.

The first three have different flags
Source: "D:\wampserver\install_files\close\*.*"; DestDir: "{app}\"; Flags: ignoreversion recursesubdirs deleteafterinstall;AfterInstall: close({app})
Source: "D:\wampserver\install_files\program\*.*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs;
Source: "D:\wampserver\install_files\local_root\*.*"; DestDir: "{app}\"; Flags: ignoreversion recursesubdirs onlyifdoesntexist;

This one has different flags and points to the mysql folder.
Source: "D:\wampserver\install_files\mysql\*.*"; DestDir: "{app}\mysql\"; Flags: ignoreversion recursesubdirs onlyifdoesntexist;

This one refers to only one file so there is no problem.
Source: "D:\wampserver\install_files\mysql_ini\my.install"; DestDir: "{app}\mysql\"; Flags: ignoreversion;AfterInstall: myinifiles({app})

So I will create the above folders in my C drive.
1) C:\wampserver\install_files\close\
2) C:\wampserver\install_files\program\
3) C:\wampserver\install_files\local_root\
4) C:\wampserver\install_files\mysql\
5) C:\wampserver\install_files\mysql_ini\
What to put inside them?


The contents of the other folders needs to be determined by looking at the flags on the massive list of files (not using wildcards) in install_script.iss generated when we unpack WAMP5
Looking the flags
1) Flags: ignoreversion recursesubdirs deleteafterinstall;AfterInstall: close({app})
recursesubdirs is on none of the file statements in install_scripts.iss
because it is only appropriate to wildcards. The only line in install_scripts.iss that has similar flags is

Source: "{app}\closewamp.bat"; DestDir: "{app}"; AfterInstall: "close({app})"; Flags: uninsneveruninstall deleteafterinstall ignoreversion

So I will put only
closewamp.bat
into
C:\wampserver\install_files\close\

2) Flags: ignoreversion recursesubdirs;
This seems to be the vast majority of files, so I will come back to it.

3) Flags: ignoreversion recursesubdirs onlyifdoesntexist;
in install_script.iss it seems that all this "only if does not exist" flag is applied to
3.1) The three files in the www directory
3.2) various mysql files that contain the database I presume.
okay, so I think that I should put the three files, and the php thing I want to install into
C:\wampserver\install_files\local_root\
hold on a minute. This is called "local_root." Perhaps it should be enough just to have the php files? drat. hmm.. I cam going to put two folders in there
www
and
mysql
and then in the first one I will put the three WAMP5 files and the software I want to package, and in the second, the data subfolder of mysql.
4) This is the rest of mysql for sure. And it
5) This is easy just "my.install"

Then I need to add the call to the batt file for my application (which is in another similar installer).

Hmm....i will now compile.

Options: ReplyQuote
Re: Bundling with or inside WAMP
Posted by: timtak (---.c-able.ne.jp)
Date: October 29, 2006 02:13PM

Compiling Errors

first of all I I got I/O error 21 which is device not ready/found because I had forgottten to change D to C in the first few lines and there are no bmp or ico files in wampserver. I removed the bmp and added my own ico.

Then I find that this (which is in the WAMP5 iss file

;Source: "C:\wampserver\install_files\close\*.*"; DestDir: "{app}\"; Flags: ignoreversion recursesubdirs deleteafterinstall;AfterInstall: close({app})

Throws a syntax error on the ({app}) part. I removed it.

Similarly it does not like
;Source: "C:\wampserver\install_files\mysql_ini\my.install"; DestDir: "{app}\mysql\"; Flags: ignoreversion;AfterInstall: myinifiles({app})

Throws a syntax error on the ({app}) part. I removed it.

Then it does not recognise
InstExec
in the
 section

I see that this is due to the version of Inno being different! There is an experts exchange question about this 
[tinyurl.com]
where the solution was to use the older version of Inno. 

However, based on the examples of InstExec and Exec cass here
[archive.netbsd.se]
I have found a format which may work. 
Exec(batfile, '',Path+'/', SW_HIDE, ewWaitUntilTerminated, myresult);

In the line 
dr := OutputMsg('To avoid overwriting your own scripts, WAMP5 s homepage has not been copied in your DocumentRoot. If you want to use it, just copy this file from the '+FileName+'\www directory to your DocumentRoot ('+docroot+')',True);

OutputMsg is not recognised. I removed the above line
Simiarly the next line 
ScriptDlgPageClose(True);
is not recognised, I removed it. 

And then loads of lines are not recognised!!!

I am going to uninstall inno 5 and download inno 4. 

I am now using the last version four inno. And this time it seems to be compiling. It will be a real gas if it works. 

Compiling takes quite a while. If it does not work then trial and error is going to be quite tiresome.

I think that I will remove sqlitemanager whatever it is, in future attempts. 

took 11 minutes.

Tim

Options: ReplyQuote
Re: Bundling with or inside WAMP
Posted by: yfastud (---.cable.mindspring.com)
Date: October 29, 2006 02:49PM

so you compile new Apache 2.2.3?

Options: ReplyQuote
Re: Bundling with or inside WAMP
Posted by: timtak (---.c-able.ne.jp)
Date: October 29, 2006 02:59PM

1) Apache was not installed. This could be for one of two reasons
1.1) Skype was running, so the script could not run at that time because port 80 was blocked.
1.2) The install service menu item throws a message saying "file not found" this could be serious!

2) In the final external bat file, I presumed that the root directory would be wamp5 when in fact it is wamp.

3) The "would you like to overwrite index.php" is not appropriate when attempting to bundle a php web application.

4) In all places where it says wamp I am attempting to add wamp plus the application.

But this is all quite exciting.

Thank you for this exciting technology.

Tim

Options: ReplyQuote
Re: Bundling with or inside WAMP
Posted by: timtak (---.c-able.ne.jp)
Date: October 29, 2006 03:28PM

Dear Yfastud

No, I am not compiling anything new. I am just trying to add a web package (php software) into www. I used all the same server and database software that is in the latest release of WAMP5, which I got by using innounp to unpack it.

One possible reason why apache did not install might be because I removed the part of the iss file relating to the new WAMP5 homepage. I did not want to overwrite the index.php of the software I am trying to bundle with WAMP.

In other words I removed all of this.

// index.php file I think that this should all go

DestFile := FileName+'/www/index.php';
SrcFile := FileName+'/www/index.new.install';
if FileExists (DestFile) then
begin
if MsgBox('Would you like to install the new WAMP5 homepage? (this will overwrite exisiting index.php file)',mbConfirmation,MB_YESNO) = IDYES then
begin
DeleteFile (DestFile);
LoadStringFromFile (SrcFile, SrcContent);
StringChange (SrcContent, 'INS_ALIAS_DIR', FileName+'/apache2/conf/alias/');
StringChange (SrcContent, 'INS_PMA_DIR', FileName+'/phpmyadmin/');
SaveStringToFile(DestFile,SrcContent, False);
end
end
else
begin
LoadStringFromFile (SrcFile, SrcContent);
StringChange (SrcContent, 'INS_ALIAS_DIR', FileName+'/apache2/conf/alias/');
StringChange (SrcContent, 'INS_PMA_DIR', FileName+'/phpmyadmin/');
SaveStringToFile(DestFile,SrcContent, False);
end
DeleteFile (SrcFile);


But the apache stuff at the end seems important!

I could try commenting out all the stuff relating to the homepage and just leave the lines which change things related to apache like this

// index.php file I think that this should all go

//DestFile := FileName+'/www/index.php';
SrcFile := FileName+'/www/index.new.install';
//if FileExists (DestFile) then
//begin
//if MsgBox('Would you like to install the new WAMP5 homepage? (this will overwrite exisiting index.php file)',mbConfirmation,MB_YESNO) = IDYES then
//begin
//DeleteFile (DestFile);
//LoadStringFromFile (SrcFile, SrcContent);
//StringChange (SrcContent, 'INS_ALIAS_DIR', FileName+'/apache2/conf/alias/');
//StringChange (SrcContent, 'INS_PMA_DIR', FileName+'/phpmyadmin/');
//SaveStringToFile(DestFile,SrcContent, False);
//end
//end
//else
//begin
LoadStringFromFile (SrcFile, SrcContent);
StringChange (SrcContent, 'INS_ALIAS_DIR', FileName+'/apache2/conf/alias/');
StringChange (SrcContent, 'INS_PMA_DIR', FileName+'/phpmyadmin/');
SaveStringToFile(DestFile,SrcContent, False);
//end
//DeleteFile (SrcFile);

But come to think of it, this is WAMP5 so I think that I should leave the homepage.

What I will do is put the application that I am trying to bundle in a sub directory and leave everything as it was.

Tim

Options: ReplyQuote
Re: Bundling with or inside WAMP
Posted by: yfastud (---.cable.mindspring.com)
Date: October 29, 2006 03:42PM

Oh, I think you want to make a new package installer.

If you just want to add-on something, why don't just install wampserver, then install that add-on w/ its document root inside wamp

Options: ReplyQuote
Re: Bundling with or inside WAMP
Posted by: timtak (---.c-able.ne.jp)
Date: October 29, 2006 04:14PM

I have put the application I am bundling in a sub-directory but all the same it is failing to install apache, saying as before, "file not found"

ooh...this is hard....

In the installation file there is

[Run]
Filename: "{app}\uninstall_services.bat"; Flags: runhidden
Filename: "{app}\install_services.bat"; Flags: runhidden
Filename: "{app}\install_services_auto.bat"; Flags: runhidden;Tasks: autostart

But the two files

install_services.bat
install_services_auto.bat

Do not exist in the precompiled source. This is because they exist as
install_services.install
install_services_auto.install
in
C:\wampserver\install_files\program\

and there are the following bits of code, which I think should create the .bat files from the .install files.

// install_services.bat file

DestFile := FileName+'/install_services.bat';
SrcFile := FileName+'/install_services.install';
LoadStringFromFile (SrcFile, SrcContent);
StringChange (FileName, '/','\');
StringChange (SrcContent, 'Myinstmysql','.\mysql\bin\mysqld-nt.exe --install-manual wampmysqld --defaults-file="'+FileName+'\mysql\my.ini"');
StringChange (FileName, '\','/');
if FileExists (DestFile) then
DeleteFile (DestFile);
SaveStringToFile(DestFile,SrcContent, False);
DeleteFile(SrcFile);


// install_services_auto.bat file

DestFile := FileName+'/install_services_auto.bat';
SrcFile := FileName+'/install_services_auto.install';
LoadStringFromFile (SrcFile, SrcContent);
StringChange (FileName, '/','\');
StringChange (SrcContent, 'Myinstmysql','.\mysql\bin\mysqld-nt.exe --install wampmysqld --defaults-file="'+FileName+'\mysql\my.ini"');
StringChange (FileName, '\','/');
if FileExists (DestFile) then
DeleteFile (DestFile);
SaveStringToFile(DestFile,SrcContent, False);
DeleteFile(SrcFile);

Has this happened? 

Yes, on the installed machine, these two files have changed to .bat files and EXIST as
wamp/install_services.bat
wamp/install_services_auto.bat

So why aren't these files being found?

Or perhaps it is not the .bat files but their contents?
Inside the first there is
.\apache2\bin\apache.exe -k install -n wampapache
and that seems to be the important line.

And in both the pre-compiled and post installed computers these files exist.

The only different I can see is that both the directory and the name of the file have a capital A (Apache/bin/Apache.exe vs apache/bin/apache.exe)

Does this make any difference? If so you'd think that all WAMPs would not work but of course they do (all except mine, sob).

I tried executing the batch file on the installed machine and not a lot happened. (the console flashed briefly that is all). Then I tried changing the apache to Apache inside the batch file in the installed machine and running it again, and running the command from the run prompt, but nothing happens.

Apache does not start.
The menu items for start apache and stop apache are greyed out.
When I select install apache from the WAMP menu it says "port 80 is open press any key to continue, but then there is an error message saying that a file (what file?) is not found.

I am not sure what to do.
Tim

Options: ReplyQuote
Re: Bundling with or inside WAMP
Posted by: timtak (---.c-able.ne.jp)
Date: October 29, 2006 05:33PM

Well...

The apache service does not install.

Port 80 is not used actually (this should be "is not in use now" because the French "actuellment" is different from the English "actually"winking smiley

Both the test port and the install options on the menu say that the port is not in use.

The install option on the menu results in "fie not found"

I guess that the install option is just running
wamp/install_services.bat
and this file exists.

And executing this file causes a console to flash on the screen but it disappears too quicklly to see what is happening.

The apache.exe file exists in wamp\Apache2

clicking on the Apache.exe file does nothing either.

I am not sure what to do. mysql installs and starts fine
this is the content of the mysql installer batch file
.\mysql\bin\mysqld-nt.exe --install-manual wampmysqld --defaults-file="ROOTPATH\mysql\my.ini"

And this (as mentioned above) the content of the file
wamp/install_services.bat

.\apache2\bin\apache.exe -k install -n wampapache
reg add HKLM\SYSTEM\CurrentControlSet\Services\wampapache /V Start /t REG_DWORD /d 3 /f
Myinstmysql

They look pretty much the same.

Why doesn't apache install?

Okay, what is the menu tryiing to call?
There is a file called
wampserver.ins

Which seems to provide the data from the menu. The bit that relates to installing apache looks like this

[ApacheServiceInstall] ;1.6.2
Action: run; FileName: "ROOTPATH/php/php.exe";Parameters: "-c . ../scripts/test_port_for_install.php";WorkingDir: "ROOTPATH/php"; Flags: waituntilterminated
INSai
Action: run; FileName: "reg"; Parameters: "add HKLM\SYSTEM\CurrentControlSet\Services\wampapache /V Start /t REG_DWORD /d 3 /f"; ShowCmd: hidden; Flags: waituntilterminated
Action: resetservices
Action: readconfig;

The first part which checks port 80 is not used is working fine so it must be the remainder

INSai
Action: run; FileName: "reg"; Parameters: "add HKLM\SYSTEM\CurrentControlSet\Services\wampapache /V Start /t REG_DWORD /d 3 /f"; ShowCmd: hidden; Flags: waituntilterminated
Action: resetservices
Action: readconfig;

what is wrong with that? The folowing two are everywhere
Action: resetservices
Action: readconfig
So it seems unlikely that there is any problem with them.

This looks a bit strange
FileName: "reg";

I know the file regedit but reg? Could this be the problem? But if so then everyone would be having the same problem. The parameters look just the sort of thing that
regedit.exe
would take. There does not seem to be a file called reg in my windows (2000)

What is reg?
all the other Action: run, Filename commands are followed by a path to an executable file.... e.g.
Action: run; FileName: "ROOTPATH/php/php.exe";
It seems that only php.exe and notepad.exe are the only two others used.
This is the same for notepad
Action: run; FileName: "notepad.exe";

So from a real newbie point of view, one would expect

Action: run; FileName: "regedit.exe"; Parameters: "add HKLM\SYSTEM\CurrentControlSet\Services\wampapache /V Start /t REG_DWORD /d 3 /f"; ShowCmd: hidden; Flags: waituntilterminated

could this reallly be the problem???

1) It is too much of a coincidence. I am attempting to recompile WAMP5 and to find a bug in wamp5 is too much of a coincidence. This should be something that I have done wrong.
2) Even if the menu item was compiled incorrectly, MYSQL starts no problem *without having to use the menu* hence if there is a problem then it must be with both the menu and whatever batch file was meant to have already run.

With regard to (2), the line in the batch file also says
reg add HKLM\SYSTEM\CurrentControlSet\Services\wampapache /V Start /t REG_DWORD /d 3 /f

Again there is the reference to a program "reg"

It is clearly the registry.

Is there a program or alias or something called reg?

ON this thread here there is also the file reg
[forum.wampserver.com]
and noone is complaining

I think that reg must be okay.

I have no idea what to do...

Tim

Options: ReplyQuote
Re: Bundling with or inside WAMP
Posted by: timtak (---.c-able.ne.jp)
Date: October 30, 2006 02:11AM

> Oh, I think you want to make a new package installer.
> If you just want to add-on something, why don't just install wampserver, then install that add-on w/ its document root inside wamp

Why doessn't Mr. Bourdon just let people install apache, mysql etc one by one?


The error when trying to install apace is a *menu error* it says Aestan Menu [Exception] Can not execute Run command, file not found.

In the script file for the menu I tried changing the line with "reg" in it
Action: run; FileName: "reg"; Parameters: "add HKLM\SYSTEM\CurrentControlSet\Services\wampapache /V Start /t REG_DWORD /d 3 /f"; ShowCmd: hidden; Flags: waituntilterminated

to
Action: run; FileName: "regedit.exe"; Parameters: "add HKLM\SYSTEM\CurrentControlSet\Services\wampapache /V Start /t REG_DWORD /d 3 /f"; ShowCmd: hidden; Flags: waituntilterminated

using regedit.exe and this time it does find the file. So this line seems to be the problem.

But there are complaints about the format of the parameters, so the changes are not made to the registry.

Wwhy isn't it "reg.exe"?

If there is a problem then everyone should be mentioning it. I can one other person with a similar problem here
[www.libe.net]
translated
Hello, I downloaded myself a Wamp package.
Unfortunately the Apache cannot be started. I mean to have found
the rogue out. It concerns the line:
reg ADD HKLM\SYSTEM\CurrentControlSet\Services\wampapache /V start /t REG_DWORD /d 3 /f
In the file: \wamp\install_services.bat
a) Word reg not understood.
b) There is no entry wampache in the Registry.
How does the line have to read correctly? Frigga

But no one has replied to Frigga.

I have downloaded aestan menu

It has some examples this is how the Apache is installed in an example menu .ini file for another WAMP package.

Action: run; FileName: "%ASRoot%\Apache\bin\Apache.exe"; Parameters: "-k install"; ShowCmd: hidden; Flags: waituntilterminated

Action: run; FileName: "regedit"; Parameters: "add HKLM\SYSTEM\CurrentControlSet\Services\wampapache /V Start /t REG_DWORD /d 3 /f"; ShowCmd: hidden; Flags: waituntilterminated

It is using "regedit"

But the problem is not only with the menu ini file, but also with the batch file install_services.bat where there is
reg add HKLM\SYSTEM\CurrentControlSet\Services\wampapache /V Start /t REG_DWORD /d 3 /f
if I try and run the above on my computer it says that the word reg is not recognised.

Perhaps WAMP5 is normally distributed with a dll or program called "reg" or some file that translates "reg" into "regedit"?

Tim

Options: ReplyQuote
Re: Bundling with or inside WAMP
Posted by: timtak (---.c-able.ne.jp)
Date: October 30, 2006 02:28AM

Found it! en francais....

Explication

1 / (snip)

2 / Le fichier .bat permettant d'ajouter le service apache dans la base des registres utilise la commande REG.exe qui n'est pas fourni de base avec windows 2000. Il suffit de télécharger le sp4_support_tools à l'adresse suivante : [www.microsoft.com]

Solution

1 / On stoppe les services Wamp et on quitte l'application
2 / on modifie le fichier http.conf qui se trouve dans le repertoire wamp/apache2/
3 / on install le support tools sp4
4 / on va dans le repertoire wamp et on lance install_services.bat
5 / on relance wamp

Bonne journée.

Et elle me regarda fixement !

by Christophe

So all I need to do is download those tools.

This is going to be a problem in the future. Lots of people still use win2000 don't they? Perhaps not?

Tim

Options: ReplyQuote
Re: Bundling with or inside WAMP
Posted by: timtak (---.c-able.ne.jp)
Date: November 11, 2006 01:24AM

I eventually got it to work.

There were basically 2 problems
1) The log and temp files folders were not being created. The solution was to create empty text files inside these folders.
2) The database was not being created. I tried a several ways of getting the database to create
An extra create database sql line in the php of phpmyadmin
An batch file called from a Run command
A run command taking text from a SQL file
Writing to a file and then exectuting that file (WAMP seems to do this in other cases)
and none of them worked. Finally, just copying the contents of the mysql/data folder with an empty database worked.

The remaining problem is
reg add HKLM\SYSTEM\CurrentControlSet\Services\wampapache /V Start /t REG_DWORD /d 3 /f

But in the meantime, or before, I am not sure, the php program that I wanted to bundle has created its own XAMPP packages!

But WAMP is more than 15 times smaller so perhaps there was a point to it.

Tim

Options: ReplyQuote


Sorry, only registered users may post in this forum.