CSDN博客

img jdk137

Learning PHP5/MySQL Programming

发表于2008/9/29 15:01:00  477人阅读

分类: Learning experiences


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
of php and MySQL can not help you in this way.

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
save your time.

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)

Read it carefully,you can get many helpful information.

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

run mysql : mysql -u***** -pXXXXX *****=username XXXXX = password

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/,

Just download appserv and install it.



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

1.)download php_nuke 8.0 from

http://phpnuke.org/modules.php?name=Downloads&d_op=search&
query=phpnuke%208.0
(enter 8.0 in search field to search .)

(Now php_nuke 8.1 is not free)

2.)set php_nuke follow this:

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

    (3.)sudo /usr/bin/pecl login

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

against the static library/usr/lib/perl/5.8//auto/DynaLoader/DynaLoader.a

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

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


  1. (1.)download perl-1.0.0.tgz from http://pecl.php.net/package/perl

(2.)decompress it,and follow the 3 steps of the readme file

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

the static library/usr/lib/perl/5.8//auto/DynaLoader/DynaLoader.a is not

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

3)You may find you can log in Http://127.0.0.1but can not log in Http://localhost,

insert into /etc/hosts with this line:

127.0.0.1 localhost

may help you.

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.

5)download handbooks of php and mysql, you will need them.



_______________________________________________END

May this help you!

Thanks for your advices!

0 0

相关博文

我的热门文章

img
取 消
img