LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How Apache works with PHP/MySQL/whatever... (https://www.linuxquestions.org/questions/linux-software-2/how-apache-works-with-php-mysql-whatever-85685/)

SammyK 08-25-2003 08:04 PM

How Apache works with PHP/MySQL/whatever...
 
Hi! I am kind of a newbie to Linux and I need some help understanding something.

I have an old version of PHP on my server and would like to upgrade it, but I want to make sure I know EXACTLY what I am doing before I upgrade it.

Now first of all, how do I determine how my version of PHP was complied with Apache (like if it's Static Mod or Dynamic Mod?) And second, what is the difference? I have done a lot of research online to find out, and it seems to me that the main difference between static and dynamic is that with a static mod, PHP is dependant on Apache so that if Apache is restarted, PHP also is restarted whereas this is not the case if it were dynamic.

I have changed a line of code in my php.ini file and restarted apache and the change did NOT take place which makes me think that my PHP is a dynamic mod. Is it easy to make it a static mod when I upgrade?

OK. Now the upgrade question: How do I do it? I have found TONS of PHP installation tutorials, but none really cover UPGRADING. So, after putting little bits and pieces together here is what I have come up with. When I DELETE the PHP directory off of my server, PHP will still be running... then I install the NEW version of PHP and ?restart something? and then the NEW version will come up. So it's like, you can delete PHP or MySQL or whatever, and it will keep running until you restart it, right?

I just need to know if I am about to crash my server or if my research has paid off. :) Sorry of the length of the message, and thanks in advanced to anyone willing to help out. :)

SammyK 08-26-2003 08:08 AM

Anyone? :(

SammyK 08-28-2003 11:23 PM

OK, so NO ONE helped me on this, so I had to figure crap out on my own. SO! The good news is that I successfully upgraded PHP. Now, I am a firm believer in the way forums work, so just in case someone has the same situation as me, here is what I did:

I figured out the my version of PHP was in fact dynamic, but not for the reasons listed above. If you make a file and do a <?php phpinfo() ?> you can see how PHP was configured. If you see --with-apxs anywhere, then your PHP is dynamic. apxs is an apache program that lets you add modules.

Now, if you see --with-apache, then PHP is static.

I DID NOT uninstall/delete anything during the upgrade process. If your PHP is dynamic, it's a little easier to upgrade in that there are fewer steps. Here is what I did:

Download the newest TARBALL from php.net. Untar it to /usr/local/src/ (I made the src directory and that's were I will put all my original sources.)

Code:

cd /usr/local/src/

wget http://www.php.net/path/to/php-4.x.x.tar.gz

tar xvfz php-4.x.x.tar.gz

Then go into the source directory it just made, configure, make the binaries, and install it:

Code:

cd php-4.x.x/

./configure --with-apxs=/usr/local/apachessl/bin/apxs --with-mysql --enable-trans-sid --enable-debug=no --enable-track-vars --with-gd --with-ttf --with-freetype-dir --enable-gd-native-ttf --with-zlib-dir

make

make install

I backed up my old php.ini file and put the php.ini-dist file in it's place:

Code:

cd /usr/local/lib

cp php.ini /root/php.ini.BAK

cd /usr/local/src/php-4.x.x

cp php.ini-dist /usr/local/lib/php.ini

That's it! If you have a static module, I know you have to recompile apache, but I haven't done it before, so I don't want to tell someone something that crashes their server. Sorry. :)


All times are GMT -5. The time now is 05:00 AM.