学php开发,首先是要把环境给搭建起来,然后再写出自己的第一个"helloworld"小程序。
那么怎样搭建php开发环境呢?
我是这么做的:
1.下载工具:WAMP5-v1.7.4.rar
下载地址是:http://ishare.iask.sina.com.cn/f/13827329.html?from=like
下载后,解压,得到:wamp5_1.7.4.exe安装文件。双击它,就可以安装了。
它里面集成了Apache,mysql,php等开发所需的工具。安装完成后,只需要配置一些东西就可以了。
如:mysql的端口号,Apache服务器的端口号等等,如果你的机器上面没有安装过mysql,那么端口号
的配置就可以不用管他了;如果你机器上面没有安装过tomcat服务器,那么也没有必要去配置Apache服务器的
端口号。这时候,那可以直接进入开发状态。
下面是我机器上的mysql配置:
1 # MySQL Server Instance Configuration File 2 # ---------------------------------------------------------------------- 3 # Generated by the MySQL Server Instance Configuration Wizard 4 # 5 # 6 # Installation Instructions 7 # ---------------------------------------------------------------------- 8 # 9 # On Linux you can copy this file to /etc/my.cnf to set global options, 10 # mysql-data-dir/my.cnf to set server-specific options 11 # (@localstatedir@ for this installation) or to 12 # ~/.my.cnf to set user-specific options. 13 # 14 # On Windows you should keep this file in the installation directory 15 # of your server (e.g. C:\Program Files\MySQL\MySQL Server 4.1). To 16 # make sure the server reads the config file use the startup option 17 # "--defaults-file". 18 # 19 # To run run the server from the command line, execute this in a 20 # command line shell, e.g. 21 # mysqld --defaults-file="C:\Program Files\MySQL\MySQL Server 4.1\my.ini" 22 # 23 # To install the server as a Windows service manually, execute this in a 24 # command line shell, e.g. 25 # mysqld --install MySQL41 --defaults-file="C:\Program Files\MySQL\MySQL Server 4.1\my.ini" 26 # 27 # And then execute this in a command line shell to start the server, e.g. 28 # net start MySQL41 29 # 30 # 31 # Guildlines for editing this file 32 # ---------------------------------------------------------------------- 33 # 34 # In this file, you can use all long options that the program supports. 35 # If you want to know the options a program supports, start the program 36 # with the "--help" option. 37 # 38 # More detailed information about the individual options can also be 39 # found in the manual. 40 # 41 # 42 # CLIENT SECTION 43 # ---------------------------------------------------------------------- 44 # 45 # The following options will be read by MySQL client applications. 46 # Note that only client applications shipped by MySQL are guaranteed 47 # to read this section. If you want your own MySQL client program to 48 # honor these values, you need to specify it as an option during the 49 # MySQL client library initialization. 50 # 51 [client] 52 53 port=3306 54 55 56 # SERVER SECTION 57 # ---------------------------------------------------------------------- 58 # 59 # The following options will be read by the MySQL Server. Make sure that 60 # you have installed the server correctly (see above) so it reads this 61 # file. 62 # 63 [wampmysqld] 64 65 # The TCP/IP Port the MySQL Server will listen on 66 port=3306 67 68 69 #Path to installation directory. All paths are usually resolved relative to this. 70 basedir=D:/wamp/mysql 71 72 #log file 73 log-error=D:/wamp/logs/mysql_error.log 74 75 #Path to the database root 76 datadir=D:/wamp/mysql/data 77 78 # The default character set that will be used when a new schema or table is 79 # created and no character set is defined 80 default-character-set=latin1 81 82 # The default storage engine that will be used when create new tables when 83 default-storage-engine=INNODB 84 85 # The maximum amount of concurrent sessions the MySQL server will 86 # allow. One of these connections will be reserved for a user with 87 # SUPER privileges to allow the administrator to login even if the 88 # connection limit has been reached. 89 max_connections=255 90 91 # Query cache is used to cache SELECT results and later return them 92 # without actual executing the same query once again. Having the query 93 # cache enabled may result in significant speed improvements, if your 94 # have a lot of identical queries and rarely changing tables. See the 95 # "Qcache_lowmem_prunes" status variable to check if the current value 96 # is high enough for your load. 97 # Note: In case your tables change very often or if your queries are 98 # textually different every time, the query cache may result in a 99 # slowdown instead of a performance improvement. 100 query_cache_size=8M 101 102 # The number of open tables for all threads. Increasing this value 103 # increases the number of file descriptors that mysqld requires. 104 # Therefore you have to make sure to set the amount of open files 105 # allowed to at least 4096 in the variable "open-files-limit" in 106 # section [mysqld_safe] 107 table_cache=510 108 109 # Maximum size for internal (in-memory) temporary tables. If a table 110 # grows larger than this value, it is automatically converted to disk 111 # based table This limitation is for a single table. There can be many 112 # of them. 113 tmp_table_size=13M 114 115 116 # How many threads we should keep in a cache for reuse. When a client 117 # disconnects, the client's threads are put in the cache if there aren't 118 # more than thread_cache_size threads from before. This greatly reduces 119 # the amount of thread creations needed if you have a lot of new 120 # connections. (Normally this doesn't give a notable performance 121 # improvement if you have a good thread implementation.) 122 thread_cache_size=12 123 124 #*** MyISAM Specific options 125 126 # The maximum size of the temporary file MySQL is allowed to use while 127 # recreating the index (during REPAIR, ALTER TABLE or LOAD DATA INFILE. 128 # If the file-size would be bigger than this, the index will be created 129 # through the key cache (which is slower). 130 myisam_max_sort_file_size=100G 131 132 # If the temporary file used for fast index creation would be bigger 133 # than using the key cache by the amount specified here, then prefer the 134 # key cache method. This is mainly used to force long character keys in 135 # large tables to use the slower key cache method to create the index. 136 myisam_max_extra_sort_file_size=100G 137 138 # If the temporary file used for fast index creation would be bigger 139 # than using the key cache by the amount specified here, then prefer the 140 # key cache method. This is mainly used to force long character keys in 141 # large tables to use the slower key cache method to create the index. 142 myisam_sort_buffer_size=8M 143 144 # Size of the Key Buffer, used to cache index blocks for MyISAM tables. 145 # Do not set it larger than 30% of your available memory, as some memory 146 # is also required by the OS to cache rows. Even if you're not using 147 # MyISAM tables, you should still set it to 8-64M as it will also be 148 # used for internal temporary disk tables. 149 key_buffer_size=9M 150 151 # Size of the buffer used for doing full table scans of MyISAM tables. 152 # Allocated per thread, if a full scan is needed. 153 read_buffer_size=64K 154 read_rnd_buffer_size=256K 155 156 # This buffer is allocated when MySQL needs to rebuild the index in 157 # REPAIR, OPTIMZE, ALTER table statements as well as in LOAD DATA INFILE 158 # into an empty table. It is allocated per thread so be careful with 159 # large settings. 160 sort_buffer_size=203K 161 162 163 #*** INNODB Specific options *** 164 165 166 # Use this option if you have a MySQL server with InnoDB support enabled 167 # but you do not plan to use it. This will save memory and disk space 168 # and speed up some things. 169 #skip-innodb 170 171 # Additional memory pool that is used by InnoDB to store metadata 172 # information. If InnoDB requires more memory for this purpose it will 173 # start to allocate it from the OS. As this is fast enough on most 174 # recent operating systems, you normally do not need to change this 175 # value. SHOW INNODB STATUS will display the current amount used. 176 innodb_additional_mem_pool_size=2M 177 178 # If set to 1, InnoDB will flush (fsync) the transaction logs to the 179 # disk at each commit, which offers full ACID behavior. If you are 180 # willing to compromise this safety, and you are running small 181 # transactions, you may set this to 0 or 2 to reduce disk I/O to the 182 # logs. Value 0 means that the log is only written to the log file and 183 # the log file flushed to disk approximately once per second. Value 2 184 # means the log is written to the log file at each commit, but the log 185 # file is only flushed to disk approximately once per second. 186 innodb_flush_log_at_trx_commit=1 187 188 # The size of the buffer InnoDB uses for buffering log data. As soon as 189 # it is full, InnoDB will have to flush it to disk. As it is flushed 190 # once per second anyway, it does not make sense to have it very large 191 # (even with long transactions). 192 innodb_log_buffer_size=1M 193 194 # InnoDB, unlike MyISAM, uses a buffer pool to cache both indexes and 195 # row data. The bigger you set this the less disk I/O is needed to 196 # access data in tables. On a dedicated database server you may set this 197 # parameter up to 80% of the machine physical memory size. Do not set it 198 # too large, though, because competition of the physical memory may 199 # cause paging in the operating system. Note that on 32bit systems you 200 # might be limited to 2-3.5G of user level memory per process, so do not 201 # set it too high. 202 innodb_buffer_pool_size=15M 203 204 # Size of each log file in a log group. You should set the combined size 205 # of log files to about 25%-100% of your buffer pool size to avoid 206 # unneeded buffer pool flush activity on log file overwrite. However, 207 # note that a larger logfile size will increase the time needed for the 208 # recovery process. 209 innodb_log_file_size=10M 210 211 # Number of threads allowed inside the InnoDB kernel. The optimal value 212 # depends highly on the application, hardware as well as the OS 213 # scheduler properties. A too high value may lead to thread thrashing. 214 innodb_thread_concurrency=8
下面是我机器上的Apache的配置: 有些开发者在第一次配置apache服务的时候,老是启动不了Apache服务器,大多数原因是因为apache的端口号被占用了
解决的办法是:修改端口号,如下面我的端口号就修改为"2000"
1 # 2 # This is the main Apache HTTP server configuration file. It contains the 3 # configuration directives that give the server its instructions. 4 # See <URL:http://httpd.apache.org/docs/2.2/> for detailed information. 5 # In particular, see 6 # <URL:http://httpd.apache.org/docs/2.2/mod/directives.html> 7 # for a discussion of each configuration directive. 8 # 9 # Do NOT simply read the instructions in here without understanding 10 # what they do. They're here only as hints or reminders. If you are unsure 11 # consult the online docs. You have been warned. 12 # 13 # Configuration and logfile names: If the filenames you specify for many 14 # of the server's control files begin with "/" (or "drive:/" for Win32), the 15 # server will use that explicit path. If the filenames do *not* begin 16 # with "/", the value of ServerRoot is prepended -- so "logs/foo.log" 17 # with ServerRoot set to "C:/Program Files/Apache Software Foundation/Apache2.2" will be interpreted by the 18 # server as "C:/Program Files/Apache Software Foundation/Apache2.2/logs/foo.log". 19 # 20 # NOTE: Where filenames are specified, you must use forward slashes 21 # instead of backslashes (e.g., "c:/apache" instead of "c:\apache"). 22 # If a drive letter is omitted, the drive on which Apache.exe is located 23 # will be used by default. It is recommended that you always supply 24 # an explicit drive letter in absolute paths, however, to avoid 25 # confusion. 26 # 27 28 # ThreadsPerChild: constant number of worker threads in the server process 29 # MaxRequestsPerChild: maximum number of requests a server process serves 30 ThreadsPerChild 250 31 MaxRequestsPerChild 0 32 33 # 34 # ServerRoot: The top of the directory tree under which the server's 35 # configuration, error, and log files are kept. 36 # 37 # Do not add a slash at the end of the directory path. If you point 38 # ServerRoot at a non-local disk, be sure to point the LockFile directive 39 # at a local disk. If you wish to share the same ServerRoot for multiple 40 # httpd daemons, you will need to change at least LockFile and PidFile. 41 # 42 ServerRoot "D:/wamp/apache2" 43 44 # 45 # Listen: Allows you to bind Apache to specific IP addresses and/or 46 # ports, instead of the default. See also the <VirtualHost> 47 # directive. 48 # 49 # Change this to Listen on specific IP addresses as shown below to 50 # prevent Apache from glomming onto all bound IP addresses (0.0.0.0) 51 # 52 #Listen 12.34.56.78:80 53 Listen 2000 54 55 # 56 # Dynamic Shared Object (DSO) Support 57 # 58 # To be able to use the functionality of a module which was built as a DSO you 59 # have to place corresponding `LoadModule' lines at this location so the 60 # directives contained in it are actually available _before_ they are used. 61 # Statically compiled modules (those listed by `httpd -l') do not need 62 # to be loaded here. 63 # 64 # Example: 65 # LoadModule foo_module modules/mod_foo.so 66 # 67 LoadModule actions_module modules/mod_actions.so 68 LoadModule alias_module modules/mod_alias.so 69 LoadModule asis_module modules/mod_asis.so 70 LoadModule auth_basic_module modules/mod_auth_basic.so 71 #LoadModule auth_digest_module modules/mod_auth_digest.so 72 #LoadModule authn_anon_module modules/mod_authn_anon.so 73 #LoadModule authn_dbm_module modules/mod_authn_dbm.so 74 LoadModule authn_default_module modules/mod_authn_default.so 75 LoadModule authn_file_module modules/mod_authn_file.so 76 #LoadModule authz_dbm_module modules/mod_authz_dbm.so 77 LoadModule authz_default_module modules/mod_authz_default.so 78 LoadModule authz_groupfile_module modules/mod_authz_groupfile.so 79 LoadModule authz_host_module modules/mod_authz_host.so 80 LoadModule authz_user_module modules/mod_authz_user.so 81 LoadModule autoindex_module modules/mod_autoindex.so 82 LoadModule cern_meta_module modules/mod_cern_meta.so 83 LoadModule cgi_module modules/mod_cgi.so 84 #LoadModule dav_module modules/mod_dav.so 85 #LoadModule dav_fs_module modules/mod_dav_fs.so 86 #LoadModule deflate_module modules/mod_deflate.so 87 LoadModule dir_module modules/mod_dir.so 88 LoadModule env_module modules/mod_env.so 89 #LoadModule expires_module modules/mod_expires.so 90 #LoadModule file_cache_module modules/mod_file_cache.so 91 #LoadModule headers_module modules/mod_headers.so 92 LoadModule imagemap_module modules/mod_imagemap.so 93 LoadModule include_module modules/mod_include.so 94 #LoadModule info_module modules/mod_info.so 95 LoadModule isapi_module modules/mod_isapi.so 96 LoadModule log_config_module modules/mod_log_config.so 97 LoadModule mime_module modules/mod_mime.so 98 #LoadModule mime_magic_module modules/mod_mime_magic.so 99 #LoadModule proxy_module modules/mod_proxy.so 100 #LoadModule proxy_ajp_module modules/mod_proxy_ajp.so 101 #LoadModule proxy_balancer_module modules/mod_proxy_balancer.so 102 #LoadModule proxy_connect_module modules/mod_proxy_connect.so 103 #LoadModule proxy_http_module modules/mod_proxy_http.so 104 #LoadModule proxy_ftp_module modules/mod_proxy_ftp.so 105 LoadModule negotiation_module modules/mod_negotiation.so 106 #LoadModule rewrite_module modules/mod_rewrite.so 107 LoadModule setenvif_module modules/mod_setenvif.so 108 #LoadModule speling_module modules/mod_speling.so 109 #LoadModule status_module modules/mod_status.so 110 #LoadModule unique_id_module modules/mod_unique_id.so 111 LoadModule userdir_module modules/mod_userdir.so 112 #LoadModule usertrack_module modules/mod_usertrack.so 113 #LoadModule vhost_alias_module modules/mod_vhost_alias.so 114 #LoadModule ssl_module modules/mod_ssl.so 115 LoadModule php5_module "D:/wamp/php/php5apache2_2.dll" 116 117 # 'Main' server configuration 118 # 119 # The directives in this section set up the values used by the 'main' 120 # server, which responds to any requests that aren't handled by a 121 # <VirtualHost> definition. These values also provide defaults for 122 # any <VirtualHost> containers you may define later in the file. 123 # 124 # All of these directives may appear inside <VirtualHost> containers, 125 # in which case these default settings will be overridden for the 126 # virtual host being defined. 127 # 128 129 # 130 # ServerAdmin: Your address, where problems with the server should be 131 # e-mailed. This address appears on some server-generated pages, such 132 # as error documents. e.g. admin@your-domain.com 133 # 134 ServerAdmin webmaster@localhost 135 136 # 137 # ServerName gives the name and port that the server uses to identify itself. 138 # This can often be determined automatically, but we recommend you specify 139 # it explicitly to prevent problems during startup. 140 # 141 # If your host doesn't have a registered DNS name, enter its IP address here. 142 # 143 ServerName localhost:2000 144 145 # 146 # DocumentRoot: The directory out of which you will serve your 147 # documents. By default, all requests are taken from this directory, but 148 # symbolic links and aliases may be used to point to other locations. 149 # 150 DocumentRoot "D:/wamp/www" 151 152 # 153 # Each directory to which Apache has access can be configured with respect 154 # to which services and features are allowed and/or disabled in that 155 # directory (and its subdirectories). 156 # 157 # First, we configure the "default" to be a very restrictive set of 158 # features. 159 # 160 <Directory /> 161 Options FollowSymLinks 162 AllowOverride None 163 Order deny,allow 164 Deny from all 165 Satisfy all 166 </Directory> 167 168 # 169 # Note that from this point forward you must specifically allow 170 # particular features to be enabled - so if something's not working as 171 # you might expect, make sure that you have specifically enabled it 172 # below. 173 # 174 175 # 176 # This should be changed to whatever you set DocumentRoot to. 177 # 178 <Directory "D:/wamp/www"> 179 180 # 181 # Possible values for the Options directive are "None", "All", 182 # or any combination of: 183 # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews 184 # 185 # Note that "MultiViews" must be named *explicitly* --- "Options All" 186 # doesn't give it to you. 187 # 188 # The Options directive is both complicated and important. Please see 189 # http://httpd.apache.org/docs/2.2/mod/core.html#options 190 # for more information. 191 # 192 Options Indexes FollowSymLinks 193 194 # 195 # AllowOverride controls what directives may be placed in .htaccess files. 196 # It can be "All", "None", or any combination of the keywords: 197 # Options FileInfo AuthConfig Limit 198 # 199 AllowOverride all 200 201 # 202 # Controls who can get stuff from this server. 203 # 204 # onlineoffline tag - don't remove 205 Order Allow,Deny 206 Allow from all 207 208 </Directory> 209 210 # 211 # DirectoryIndex: sets the file that Apache will serve if a directory 212 # is requested. 213 # 214 <IfModule dir_module> 215 DirectoryIndex index.php index.php3 index.html index.htm index.html.var 216 </IfModule> 217 218 # 219 # The following lines prevent .htaccess and .htpasswd files from being 220 # viewed by Web clients. 221 # 222 <FilesMatch "^\.ht"> 223 Order allow,deny 224 Deny from all 225 </FilesMatch> 226 227 # 228 # ErrorLog: The location of the error log file. 229 # If you do not specify an ErrorLog directive within a <VirtualHost> 230 # container, error messages relating to that virtual host will be 231 # logged here. If you *do* define an error logfile for a <VirtualHost> 232 # container, that host's errors will be logged there and not here. 233 # 234 ErrorLog ../logs/apache_error.log 235 236 # 237 # LogLevel: Control the number of messages logged to the error_log. 238 # Possible values include: debug, info, notice, warn, error, crit, 239 # alert, emerg. 240 # 241 LogLevel warn 242 243 <IfModule log_config_module> 244 # 245 # The following directives define some format nicknames for use with 246 # a CustomLog directive (see below). 247 # 248 LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined 249 LogFormat "%h %l %u %t \"%r\" %>s %b" common 250 251 <IfModule logio_module> 252 # You need to enable mod_logio.c to use %I and %O 253 LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio 254 </IfModule> 255 256 # 257 # The location and format of the access logfile (Common Logfile Format). 258 # If you do not define any access logfiles within a <VirtualHost> 259 # container, they will be logged here. Contrariwise, if you *do* 260 # define per-<VirtualHost> access logfiles, transactions will be 261 # logged therein and *not* in this file. 262 # 263 CustomLog ../logs/access.log common 264 265 # 266 # If you prefer a logfile with access, agent, and referer information 267 # (Combined Logfile Format) you can use the following directive. 268 # 269 #CustomLog logs/access.log combined 270 </IfModule> 271 272 <IfModule alias_module> 273 # 274 # Redirect: Allows you to tell clients about documents that used to 275 # exist in your server's namespace, but do not anymore. The client 276 # will make a new request for the document at its new location. 277 # Example: 278 # Redirect permanent /foo http://localhost/bar 279 280 # 281 # Alias: Maps web paths into filesystem paths and is used to 282 # access content that does not live under the DocumentRoot. 283 # Example: 284 # Alias /webpath /full/filesystem/path 285 # 286 # If you include a trailing / on /webpath then the server will 287 # require it to be present in the URL. You will also likely 288 # need to provide a <Directory> section to allow access to 289 # the filesystem path. 290 291 # 292 # ScriptAlias: This controls which directories contain server scripts. 293 # ScriptAliases are essentially the same as Aliases, except that 294 # documents in the target directory are treated as applications and 295 # run by the server when requested rather than as documents sent to the 296 # client. The same rules about trailing "/" apply to ScriptAlias 297 # directives as to Alias. 298 # 299 ScriptAlias /cgi-bin/ "D:/wamp/Apache2/cgi-bin/" 300 301 </IfModule> 302 303 # 304 # "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin" should be changed to whatever your ScriptAliased 305 # CGI directory exists, if you have that configured. 306 # 307 <Directory "D:/wamp/apache2/cgi-bin"> 308 AllowOverride None 309 Options None 310 Order allow,deny 311 Allow from all 312 </Directory> 313 314 # 315 # Apache parses all CGI scripts for the shebang line by default. 316 # This comment line, the first line of the script, consists of the symbols 317 # pound (#) and exclamation (!) followed by the path of the program that 318 # can execute this specific script. For a perl script, with perl.exe in 319 # the C:\Program Files\Perl directory, the shebang line should be: 320 321 #!c:/program files/perl/perl 322 323 # Note you _must_not_ indent the actual shebang line, and it must be the 324 # first line of the file. Of course, CGI processing must be enabled by 325 # the appropriate ScriptAlias or Options ExecCGI directives for the files 326 # or directory in question. 327 # 328 # However, Apache on Windows allows either the Unix behavior above, or can 329 # use the Registry to match files by extention. The command to execute 330 # a file of this type is retrieved from the registry by the same method as 331 # the Windows Explorer would use to handle double-clicking on a file. 332 # These script actions can be configured from the Windows Explorer View menu, 333 # 'Folder Options', and reviewing the 'File Types' tab. Clicking the Edit 334 # button allows you to modify the Actions, of which Apache 1.3 attempts to 335 # perform the 'Open' Action, and failing that it will try the shebang line. 336 # This behavior is subject to change in Apache release 2.0. 337 # 338 # Each mechanism has it's own specific security weaknesses, from the means 339 # to run a program you didn't intend the website owner to invoke, and the 340 # best method is a matter of great debate. 341 # 342 # To enable the this Windows specific behavior (and therefore -disable- the 343 # equivilant Unix behavior), uncomment the following directive: 344 # 345 #ScriptInterpreterSource registry 346 # 347 # The directive above can be placed in individual <Directory> blocks or the 348 # .htaccess file, with either the 'registry' (Windows behavior) or 'script' 349 # (Unix behavior) option, and will override this server default option. 350 # 351 352 # 353 # DefaultType: the default MIME type the server will use for a document 354 # if it cannot otherwise determine one, such as from filename extensions. 355 # If your server contains mostly text or HTML documents, "text/plain" is 356 # a good value. If most of your content is binary, such as applications 357 # or images, you may want to use "application/octet-stream" instead to 358 # keep browsers from trying to display binary files as though they are 359 # text. 360 # 361 DefaultType text/plain 362 363 <IfModule mime_module> 364 # 365 # TypesConfig points to the file containing the list of mappings from 366 # filename extension to MIME-type. 367 # 368 TypesConfig conf/mime.types 369 370 # 371 # AddType allows you to add to or override the MIME configuration 372 # file specified in TypesConfig for specific file types. 373 # 374 #AddType application/x-gzip .tgz 375 # 376 # AddEncoding allows you to have certain browsers uncompress 377 # information on the fly. Note: Not all browsers support this. 378 # 379 #AddEncoding x-compress .Z 380 #AddEncoding x-gzip .gz .tgz 381 # 382 # If the AddEncoding directives above are commented-out, then you 383 # probably should define those extensions to indicate media types: 384 # 385 AddType application/x-compress .Z 386 AddType application/x-gzip .gz .tgz 387 AddType application/x-httpd-php .php 388 AddType application/x-httpd-php .php3 389 # 390 # AddHandler allows you to map certain file extensions to "handlers": 391 # actions unrelated to filetype. These can be either built into the server 392 # or added with the Action directive (see below) 393 # 394 # To use CGI scripts outside of ScriptAliased directories: 395 # (You will also need to add "ExecCGI" to the "Options" directive.) 396 # 397 #AddHandler cgi-script .cgi 398 399 # For type maps (negotiated resources): 400 #AddHandler type-map var 401 402 # 403 # Filters allow you to process content before it is sent to the client. 404 # 405 # To parse .shtml files for server-side includes (SSI): 406 # (You will also need to add "Includes" to the "Options" directive.) 407 # 408 #AddType text/html .shtml 409 #AddOutputFilter INCLUDES .shtml 410 </IfModule> 411 412 # 413 # The mod_mime_magic module allows the server to use various hints from the 414 # contents of the file itself to determine its type. The MIMEMagicFile 415 # directive tells the module where the hint definitions are located. 416 # 417 #MIMEMagicFile conf/magic 418 419 # 420 # Customizable error responses come in three flavors: 421 # 1) plain text 2) local redirects 3) external redirects 422 # 423 # Some examples: 424 #ErrorDocument 500 "The server made a boo boo." 425 #ErrorDocument 404 /missing.html 426 #ErrorDocument 404 "/cgi-bin/missing_handler.pl" 427 #ErrorDocument 402 http://localhost/subscription_info.html 428 # 429 430 # 431 # EnableMMAP and EnableSendfile: On systems that support it, 432 # memory-mapping or the sendfile syscall is used to deliver 433 # files. This usually improves server performance, but must 434 # be turned off when serving from networked-mounted 435 # filesystems or if support for these functions is otherwise 436 # broken on your system. 437 # 438 #EnableMMAP off 439 #EnableSendfile off 440 441 # Supplemental configuration 442 # 443 # The configuration files in the conf/extra/ directory can be 444 # included to add extra features or to modify the default configuration of 445 # the server, or you may simply copy their contents here and change as 446 # necessary. 447 448 # Server-pool management (MPM specific) 449 #Include conf/extra/httpd-mpm.conf 450 451 # Multi-language error messages 452 #Include conf/extra/httpd-multilang-errordoc.conf 453 454 # Fancy directory listings 455 #Include conf/extra/httpd-autoindex.conf 456 457 # Language settings 458 #Include conf/extra/httpd-languages.conf 459 460 # User home directories 461 #Include conf/extra/httpd-userdir.conf 462 463 # Real-time info on requests and configuration 464 #Include conf/extra/httpd-info.conf 465 466 # Virtual hosts 467 #Include conf/extra/httpd-vhosts.conf 468 469 # Local access to the Apache HTTP Server Manual 470 #Include conf/extra/httpd-manual.conf 471 472 # Distributed authoring and versioning (WebDAV) 473 #Include conf/extra/httpd-dav.conf 474 475 # Various default settings 476 #Include conf/extra/httpd-default.conf 477 478 # Secure (SSL/TLS) connections 479 #Include conf/extra/httpd-ssl.conf 480 # 481 # Note: The following must must be present to support 482 # starting without SSL on platforms with no /dev/random equivalent 483 # but a statically compiled-in mod_ssl. 484 # 485 <IfModule ssl_module> 486 SSLRandomSeed startup builtin 487 SSLRandomSeed connect builtin 488 </IfModule> 489 490 491 Include "D:/wamp/apache2/conf/alias/phpmyadmin.conf" 492 Include "D:/wamp/apache2/conf/alias/sqlitemanager.conf" 493 Include "D:/wamp/apache2/conf/alias/hongten.conf"
2,写自己的第一个php小程序
环境搭建好了,就可以写自己的第一个php小程序了
开发工具的选择:
有很多开发工具可供你选择:EditPlus,记事本,eclipse for php等等
在这里我推荐使用:eclipse-php-helios-win32.zip
这对有java开发经验的同志来说应该是好事儿.....
下面是我的第一个php小程序:helloworld.php
1 <?php 2 echo "helloworld!"; 3 ?>
在浏览器的地址栏上面输入:http://localhost:2000/helloworld.php
运行效果:
helloworld!
=================================================
大功告成!
=================================================