## CSDN博客

### Learning PHP5/MySQL Programming

1.set Apache MySQL PHP environment

2.Turn on register-globals in the PHP.INI to retrieve the data from another php page

3.php_nuke install

4.install Perl interpreter in php.

5.some small problems you may meet and some tricks

I learned PHP5/MySQL Programming this summer,used this book :
PHP5/MySQL Programming for absolutely beginner , by ANDY HARRIS .
This book may be a little boring for someone who has some experiences of html ,
java and perl programming , but it gives many examples of PHP and MySQL
programming, gives readers the whole impression of a php project,the handbooks

I wasted a lot of time in setting php programming environment. Here I would
like to show some of my solutions of environment exploring.I hope them can

1.set Apache MySQL PHP environment

My operation system is ubuntu 7.10, I found a wonderful guide of LAMP.

### InstallingLAMP on Ubuntu 7.10/8.04 (Linux,Apache,MySQL,PHP)

There is a mistake in the guide : when you run the php file < ? echo "hello,world!" ?>

make sure there is no space between “<” and ” ?”.

some useful instructions

stop apache : sudo /etc/init.d/apache2 stop

start apache : sudo /etc/init.d/apache2 start

restart apache : sudo /etc/init.d/apache2 restart

edit anfile with root authority : sudo gedit /.......

If you can not open a file or some image,the most probability is you do no
have authority.You can change authority with chmod command:

sudochmod (-Rc ) 777 /.....

the path of php directory : /var/www/

If your operation system is windows,the precess would be much easier.

Enter this site http://www.appservnetwork.com/,

2.Turn on register-globals in the PHP.INI to to retrieve the data

Some PHP servers have turned off the ability to automatically create avariable

from a form. You might be able to convince your server administrator to turn on

register_globals in the PHP.INI file.If not, here’s a workaround: If your form

has a field called userName, add this code to the beginning of the program that

needs the value of that field:

$userName=$_REQUEST[“userName”];

Repeat this code for every variable you wish to pull from the original form.

For a complete explanation of this code, skip to chapter 5, “Better Arrays and

String Handling.” In that chapter you also find a routine for automatically

extracting all a form’s fields, even if you don’t know the field names.

The path of php.ini : /etc/php5/apache2 (sudo gedit/etc/php5/apache2/php.ini)

The path of httpd.conf : /etc/apache2/ (sudo gedit/etc/apache2/httpd.conf)

3.php_nukeinstall

query=phpnuke%208.0
(enter 8.0 in search field to search .)

(Now php_nuke 8.1 is not free)

http://www.phpnuke.org.cn/modules.php?name=News&file=article&sid=101

(It's Chinese ,you can choose lunguage in English. )

4.install Perl interpreter in php.

(if you meet this error in the precess: /usr/bin/phpize: No such file ordirectory

run this command: sudo apt-get install php5-dev)

There are two ways:

1. (1.)sudo apt-get install php5-cgi

(2.) sudo apt-get install php5-pear

(if you meet this warnning like this : Linking the shared library perl.la

is not portable.You can run this command : sudo apt-get install libperl-dev )

(4.)sudo/usr/bin/pecl install perl

(if you meet this warnning like this : Linking the shared library perl.la against

portable.You can run this command : sudo apt-get install libperl-dev )

5.some small problems you may meet and some tricks:

1)When you can not open a file ,make sure the authority is right.

2)You may open a image file failed,make sure you have the right authority,

and you can run php file

< ? phpInfo(); ?>

(make sure there is no space between “<” and ” ?”)

to find outwhether that kind of image is supported by php.

You can run this command to install gd package ,then many kinds of image files

would be supported:

sudo apt-get install php5-gd

insert into /etc/hosts with this line:

127.0.0.1 localhost

4)If you import an XML file in php but meet this error: “ XML declaration allowed

only at the start of the document “ ,make sure the first line of XML is ,no space line.

_______________________________________________END