Compile PHP safely

Maniak

Verified User
Joined
Aug 25, 2004
Messages
222
Location
Switzerland
My tip to compile PHP safely

I noticed some people has trouble or server crash when they compile PHP and they cannot access their server anymore.

I would advice to have webmin ready to be started, and run it before any major compilation. The rest of the time shut down.

Webmin is a tool that allow you to get connected and run some system commands (can be useful in case of crash), in fact early all what you do by shell can be done by Webmin, but it's unsafe to let it running when you don't need.

How to install it :

# cd /usr/local/src
# wget http://prdownloads.sourceforge.net/webadmin/webmin-1.290.tar.gz
# tar -zxf webmin-1.290.tar.gz
# cd webmin-1.290
# ./setup.sh

Answer yes to all except start at boot and choose login: root and password your password.

Before compiling php, start webmin.

# service start webmin

then run your PHP routine to upgrade. In order to avoid all that problem use ./build php n (it will upgrade PHP but not all modules) that does need to be rebuild each time.

When you PHP version is up-to-date shutdown webmin.

# service webmin stop

If your server crashed while the recompilation, use webmin to retrive it. How ?

access this url : http://YOURIP:10000

Login: root
Password: yourpassword

When logged, choose "Other" in the top menu, then "Command Shell" and type :

service directadmin restart

press "Execute command", you can restart all service in the same way or restart it from Directadmin panel as admin.

Recompile all, if you notice a PHP problem use

# ./build php n

(it should not big anymore).

If the problem persist ask some help here or to the Directadmin staff.

Don't forget to shutdown webmin when it's done.

Note: if you have a firewall and used default config, open the port 10000 or the port you configured.

Enjoy :D
 
Last edited:
Someone found out this is related to zlib in some way and a easy solution is to have a statically compiled sshd. the server itself doesnt crash just the sshd daemon.
 
Back
Top