Jump to content
The Uniform Server Community

Shared Dynamic Link Library (DLL)


 Share

Recommended Posts

Hello every one.

 

I want to ask who ever used Uniform Server and had technical problems about integrate or extend the package, by adding Apache Modules, PHP extensions or adding extra binary programs, and still wanted to maintain the portability of Uniform Server, did you managed ?

 

For example, my case: I want to use PHP extension for PostgreSQL (php_pgsql.dll), i quick step to do it is to enable the extension in PHP.ini file. However, when you start uniform server, php issue a error it could not find libpq.dll and php_pgsql.dll. and because php_pgsql.dll depend on libpq.dll. Originally the file libpq.dll exist in the original distribution of PHP in the main folder. However of you added the file to \usr\local\php folder, still, won't work. and that's because \usr\local\php in the system paths where the operating system will look -in.

 

The common way to do so, is to add \usr\local\php to the Windows paths, which is not proper for portability of the uniform server package.

 

To so, my tip, follow this steps:

1- create a folder in"usr" and named it "shared', here i am trying to follow similar structure like unix-based.

2- copy the file "Start_UniTray.bat" found in either of "Alternative_control" or "unicon\tray_menu" to main root of Uniform Server, where ever you placed it in your computer,USB,Cd-rom, portable Hd, etc.

3- edit the copied file "Start_UniTray.bat" by placing the following line:

set path=%path%;..\..\usr\shared

before the line of :

..\usr\local\php\php-win.exe -n  ..\unicon\tray_menu\start_unitray.php

4- save the file.

5- copy the depended-on DLL files to that folder "usr\shared", such libpq.dll and enable php extension "php_pgsql.dll".

6- Start your uniform server by double click on copied "Start_UniTray.bat" in main root of uniform servers.

 

In addition to the main benefit, you can reduce some of the duplicated depended DLL files of uniform server main components(Apache2,SSL_cert_Gen and php), such as zlib1.dll, ssleay32.dll and libeay32.dll, by keeping only in the shared DLL folder.

 

This tip is done using DOS Batch-files commands. I hope that Uniform server team apply it in PHP. I tried but I found the difficulties, so i applied it the easy way I knew. :)

 

there are other technical things to talk about in terms of scalable integration framework. but this is for now.

Link to comment
Share on other sites

Looks interesting. Especially removing duplication.

 

What OS was this tested on?

Which version of US are you using?

 

Just wondering does it fail with multi-servers.

For example take your existing UniServer folder and copy it to two test folders

Test 1 and Test2

 

Close any running servers.

Run the server in Test1 and run move servers.

Close this server.

 

Run the server in Test2 and run move servers twice.

Now run server in Test1

 

With the two running servers are there any issue?

 

I don’t have time to perform the above; will be interested in your results.

 

All the best

Ric :)

Link to comment
Share on other sites

Regarding the OS. i used Windows 7,but I expect the batch will work with Windows 2000,XP and upward.

Regarding the US I am using 5.6.5 Nano, but my experiments of the topic returns to version 3.5, where virtual substituted W drive was the main concept of US.

 

The basic idea is each of CMD and batch file execution process creates its own workspace in the computer memory without touching the main (root) workspace environment setting. These issued workspaces inherited their environment setting from their issuing parent workspace.

 

For example, create a batch file name TEST1.bat with the following setting:

 

echo %path% > c:\before_test1_output.txt
set path= Hello world
echo %path% > c:\after_test1_output.txt
call test2.bat
echo %path% > c:\final_output.txt

 

TEST2.bat

echo %path% > c:\before_test2_output.txt
set path=%path% \n and Hello Uniserver fans
echo %path% > c:\after_test2_output.txt

 

After writing the batch file, execute the TEST1.bat and preform a command line (CMD) check of the current path setting by writing the following at a new invoked CMD.

 

echo %path%

 

The expected results are:

after_test1_output.txt match before_test2_output.txt , means the setting was inherited from test1 to test2.

after_test2_output.txt match final_output.txt , means call back of the external batch setting was approved by test1

before_test1_output.txt match "CMD: echo %path%" , means inheritance of the initiative test1 setting from the main system environment setting, and setting changes of the batch file did not effect the original setting of the operating system settings.

 

my modification, as you see in code, is based on the relative-path implicit navigation rule found in Unix and MS-DOS. so it depend on the relative location of folders within US Main folder container and not on full qualified path for each components in US. for more refer to :

http://msdn.microsoft.com/en-us/library/aa...file_namespaces

 

Just wondering does it fail with multi-servers.

For example take your existing UniServer folder and copy it to two test folders

Test 1 and Test2

 

Close any running servers.

Run the server in Test1 and run move servers.

Close this server.

 

Run the server in Test2 and run move servers twice.

Now run server in Test1

 

With the two running servers are there any issue?

 

Regarding multi-servers , do mean Multi-servers at runtime ? My modification do not touch affect such problem and to do so each server should have its own port number different form the other.

 

However, if you mean of multi-servers as multi-copies of US within a the same computer, therefore, my modification as I said before is based on the relative-path.

 

If US is stored in Test1, then Shared folder has identical path as Test1\usr\shared. and If the US is stored in Teast2, then the shared folder has the identical path as Teast2\usr\shared.

 

Where the each of US package can be tested is sequencing fashion and not parallel fashion. where the testing are done by starting US, viewing PHPinfo details, shutting down the US.

 

I hope that answers your questions. :)

 

I have attached my batch file modification so you can teast it, just copy the batch file to your US main folder, where start.exe exist. And add a folder named shared into usr, enable some of php extension that have depend files such php_pgsql.dll and php_intl.dll and put the depended DLLs inside the shared folders.

 

In addition, move the file duplicated files into shared that I mentioned previously, where only one copy of each duplicated file is maintained. and run the server.

 

The testing will take about 30 minutes at maximum.

Alter_Start_UniTray.zip

Link to comment
Share on other sites

BTW, The "move servers" works as usual. i managed to run three US @ one time without any conflict by using different ports, the process developed by your team does it . Its good, but I don't have any need for it currently.

 

However, I have one concern and that is when running US as services and restarting the computer. would the environment well be maintained ? I will try later and another time, because i don't have time for it, as you Ric :)

 

Any how, if in case the modification does not work when US runs as system Services, then another modification should be done on the OS registry to maintain the US search path among the OS search path.

Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
 Share

×
×
  • Create New...