Web Hosting Talk







View Full Version : PHP question


ThePrimeHost
04-09-2002, 02:13 PM
Hey guys,
Do any of you know if the PKG verison of PHP 4.x allows users to create files openly (fopen?)

Thanks in advance.


-Darrell

cyrusTvirus
04-11-2002, 03:55 AM
Why don't you compile it by hand ??? It is much easier than you might think and much more flexible.

Here is a little starter:

If you plan to use MySQL with PHP, it would best to upgrade/install first!

You should install PHP first - then Zend can be done afterwards (optional).
If you are upgrading from a previous version (using an older version of this RaqFAQ) then look down the end of this FAQ for upgrading details

Installing PHP

Logged in as 'root' (SSH/Telnet) perform the following commands

su -
##ENTER YOUR ROOT PASSWORD WHEN PROMPTED##
cd /tmp
rpm -Uvh http://www.uk2raq.com/updates/php/libjpeg-6b-16.i386.rpm
rpm -Uvh http://www.uk2raq.com/updates/php/libjpeg-devel-6b-16.i386.rpm
rpm -Uvh http://www.uk2raq.com/updates/php/libpng-1.0.12-2.i386.rpm
rpm -Uvh http://www.uk2raq.com/updates/php/libpng-devel-1.0.12-2.i386.rpm
rpm -Uvh http://www.uk2raq.com/updates/php/libtiff-3.5.5-12.i386.rpm
rpm -Uvh http://www.uk2raq.com/updates/php/freetype-1.3.1-5.i386.rpm
rpm -Uvh http://www.uk2raq.com/updates/php/freetype-devel-1.3.1-5.i386.rpm
rpm -Uvh http://www.uk2raq.com/updates/php/freetype2-2.0.1-ximian.1.i386.rpm
rpm -Uvh http://www.uk2raq.com/updates/php/freetype2-devel-2.0.1-ximian.1.i386.rpm
rpm -Uvh http://www.uk2raq.com/updates/php/ImageMagick-4.2.9-3.i386.rpm
rpm -Uvh http://www.uk2raq.com/updates/php/ImageMagick-devel-4.2.9-3.i386.rpm
rpm -Uvh --nodeps http://www.uk2raq.com/updates/php/gd-2.0.1-1.i386.rpm
rpm -Uvh http://www.uk2raq.com/updates/php/gd-devel-2.0.1-1.i386.rpm
rpm -Uvh http://www.uk2raq.com/updates/php/gd-progs-2.0.1-1.i386.rpm
rpm -Uvh http://www.uk2raq.com/updates/php/gd-static-2.0.1-1.i386.rpm
rpm -Uvh http://www.uk2raq.com/updates/php/libtiff-devel-3.5.5-2.i386.rpm
wget http://www.uk2raq.com/updates/php/php-4.1.2.tar.gz
tar zxvf php-4.1.2.tar.gz
cd php-4.1.2
ln -s /usr/sbin/httpd /usr/bin/httpd
./configure --with-mysql --with-apxs=/usr/sbin/apxs --with-jpeg-dir=/usr/lib
--with-png-dir=/usr/lib --enable-track-vars --enable-trans-sid
--with-imap --with-gd --enable-ftp --enable-magic-quotes
--enable-inline-optimization --with-zlib-dir=/usr/lib
--enable-gd-native-ttf --with-ttf --with-pgsql
make
make install
cp php.ini-dist /usr/local/lib/php.ini

pico -w /etc/httpd/conf/httpd.conf
Change this line:

LoadModule php4_module lib/apache/libphp4.so
to

LoadModule php4_module /usr/lib/apache/libphp4.so

pico -w /etc/httpd/conf/srm.conf
Find the following line in srm.conf

#AddType application/x-httpd-php .phtml
After it, add this line

AddType application/x-httpd-php .php .php4 .phtml
This associates the .php file extension with PHP4
(If you want index.php to be served by default you need also to add/alter this as well in the section UserDir web of the same file)

# DirectoryIndex: Name of the file or files to use as a pre-written HTML
# directory index. Separate multiple entries with spaces.
DirectoryIndex index.php index.php3 index.html index.htm index.shtml home.html home.htm
Still logged in as 'root' perform the following commands to stop and restart the HTTP server

/etc/rc.d/init.d/httpd stop
/etc/rc.d/init.d/httpd start
Now to test the installation

cp /usr/local/php/sapi/servlet/jinfo.php /home/sites/home/web/jinfo.php
(you can place the jinfo.php in any suitable web directory)
Then open jinfo.php in your browser and you will see details of the installed program.



Then Install Zend

Download the zend optimiser https://www.zend.com/store/free_download.php?pid=13 you can't do a wget unfortunately - you have to register and then login and download it to your local machine.
The file you need is ZendOptimizer-1[1].2.0-PHP_4.1.0-Linux_glibc21-i386.tar.gz
I then transfered it to my RAQ via FTP to a web directory and moved it to "/usr/local/download" (has to be an easier way but I gave up and did it this way)

Logged in as 'root' perform the following commands

# Updated 1/1/2002
mv "/home/thedircontaingZendfromFTP/ZendOptimizer-1[1].2.0-PHP_4.1.0-Linux_glibc21-i386.tar.gz" /usr/local/download
su

mkdir /usr/local/Zend
mkdir /usr/local/Zend/lib
cd /usr/local/download
tar -xvzf "ZendOptimizer-1[1].2.0-PHP_4.1.0-Linux_glibc21-i386.tar.gz" # Updated 22/02/2001
cd ZendOptimizer-1.2.0-PHP_4.1.1-Linux_glibc21-i386/ # ...
mv * /usr/local/Zend # ...
cd /usr/local/Zend # ...
mv ZendOptimizer.so /usr/local/Zend/lib
Now we need to amend your php.ini file

pico -w /usr/local/lib/php.ini
Find the following section;

;;;;;;;;;;;;;;;;;;
; Fopen wrappers ;
;;;;;;;;;;;;;;;;;;
allow_url_fopen = On ; Wheter to allow trating URLs like http:... or ftp:... like files
Now add the follwing lines after the lines above!

;Zend stuff
zend_optimizer.optimization_level=15
zend_extension="/usr/local/Zend/lib/ZendOptimizer.so"
Save and exit

/etc/rc.d/init.d/httpd stop
/etc/rc.d/init.d/httpd start
Done

in your phpinfo web page (jinfo.php) you will now see that there is an additional line "with Zend Optimizer v1.1.0, Copyright (c) 1998-2000, by Zend Technologies" this shows Optimizer has installed correctly


--------------------------------------------------------------------------------

For upgrades (if you have used this faq in the past), all you need to do is this:

su -
##ENTER YOUR ROOT PASSWORD WHEN PROMPTED##
cd /tmp
wget http://www.uk2raq.com/updates/php/php-4.1.2.tar.gz
tar zxvf php-4.1.2.tar.gz
cd php-4.1.2
ln -s /usr/sbin/httpd /usr/bin/httpd
./configure --with-mysql --with-apxs=/usr/sbin/apxs --with-jpeg-dir=/usr/lib
--with-png-dir=/usr/lib --enable-track-vars --enable-trans-sid
--with-imap --with-gd --enable-ftp --enable-magic-quotes
--enable-inline-optimization --with-zlib-dir=/usr/lib
--enable-gd-native-ttf --with-ttf --with-pgsql
~~~~~~~~~~~
SHOULD BE ON ONE LINE WITH NO I REPEAT NO BREAKS IN IT.

Then

make
make install
/etc/rc.d/init.d/httpd stop
/etc/rc.d/init.d/httpd start

Omair @ HB
04-11-2002, 06:03 AM
I currently have PHP.4.0.6 installed. Any idea if I have to uninstall it first to install PHP 4.1.2 to I can install it over the old PHP?




Salam,
-Omair

cyrusTvirus
04-11-2002, 06:08 AM
Leave it and install over it. I always do that.

Robbert

Omair @ HB
04-12-2002, 05:10 PM
Hello Cyrus,

I am getting this error when installing Zend Optimizer:



[root@www download]# cd ZendOptimizer-1.2.0-PHP_4.1.1-Linux_glibc21-i386
sh: ZendOptimizer-1.2.0-PHP_4.1.1-Linux_glibc21-i386: No such file or directory
[root@www download]# cd ZendOptimizer-1.2.0-PHP_4.1.0-Linux_glibc21-i386
[root@www ZendOptimizer-1.2.0-PHP_4.1.0-Linux_glibc21-i386]# mv * /usr/local/Zend # ...
[root@www ZendOptimizer-1.2.0-PHP_4.1.0-Linux_glibc21-i386]# cd /usr/local/Zend # ...
[root@www Zend]# mv ZendOptimizer.so /usr/local/Zend/lib
mv: ZendOptimizer.so: No such file or directory
[root@www Zend]# whereis ZendOptimizer.so
ZendOptimizer:
[root@www Zend]# locate ZendOptimizer.so
locate: decode_db() aborted. Corrupt database?
[root@www Zend]#



Any idea why ZendOptimizer.so is missing?



Salam,
-Omair

cyrusTvirus
04-12-2002, 06:22 PM
Is it installled ?? Did you do a locate command ??

Omair @ HB
04-13-2002, 02:14 PM
Well,

I did a locate and could'nt find ZendOptimizer.so. So I left it and just used:


./install.sh


instead. It installed Zend Optimizer and now when I run a PHP file which is Encoded with Zend Encoder, it gives me the following error:


Fatal error: Corrupted encoded data detected in /home/sites/www.sitename.com/web/raqcp/index.php on line 0


Any idea why I am getting this error?



Salam,
-Omair

Omair @ HB
04-17-2002, 01:11 PM
Hello,

I am now getting this error when running a Zend Encoded file through Shell Prompt.


[root raqcp]# ./domain2.php

<br>
<b>Fatal error</b>: Corrupted encoded data detected in <b>/home/sites/home/raqcp/domain.php</b> on line <b>1</b><br>


Any idea why? Zend Optimizer is installed!



Salam,
-Omair