mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
- Introduce PHP_WIN32
This commit is contained in:
parent
bc5c9d8d7b
commit
f452c7762f
10 changed files with 28 additions and 26 deletions
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
#include "rfc1867.h"
|
#include "rfc1867.h"
|
||||||
|
|
||||||
#if WIN32||WINNT
|
#if PHP_WIN32
|
||||||
#define STRCASECMP stricmp
|
#define STRCASECMP stricmp
|
||||||
#else
|
#else
|
||||||
#define STRCASECMP strcasecmp
|
#define STRCASECMP strcasecmp
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#define SAPI_POST_BLOCK_SIZE 4000
|
#define SAPI_POST_BLOCK_SIZE 4000
|
||||||
|
|
||||||
#if WIN32||WINNT
|
#if PHP_WIN32
|
||||||
# ifdef SAPI_EXPORTS
|
# ifdef SAPI_EXPORTS
|
||||||
# define SAPI_API __declspec(dllexport)
|
# define SAPI_API __declspec(dllexport)
|
||||||
# else
|
# else
|
||||||
|
|
|
@ -161,7 +161,7 @@ int php_init_config(void)
|
||||||
if (!env_location) {
|
if (!env_location) {
|
||||||
env_location="";
|
env_location="";
|
||||||
}
|
}
|
||||||
#if WIN32|WINNT
|
#if PHP_WIN32
|
||||||
{
|
{
|
||||||
if (php_ini_path) {
|
if (php_ini_path) {
|
||||||
default_location = php_ini_path;
|
default_location = php_ini_path;
|
||||||
|
@ -186,7 +186,7 @@ int php_init_config(void)
|
||||||
php_ini_search_path = (char *) malloc(sizeof(".")+strlen(env_location)+strlen(default_location)+2+1);
|
php_ini_search_path = (char *) malloc(sizeof(".")+strlen(env_location)+strlen(default_location)+2+1);
|
||||||
|
|
||||||
if (!php_ini_path) {
|
if (!php_ini_path) {
|
||||||
#if WIN32|WINNT
|
#if PHP_WIN32
|
||||||
sprintf(php_ini_search_path,".;%s;%s",env_location,default_location);
|
sprintf(php_ini_search_path,".;%s;%s",env_location,default_location);
|
||||||
#else
|
#else
|
||||||
sprintf(php_ini_search_path,".:%s:%s",env_location,default_location);
|
sprintf(php_ini_search_path,".:%s:%s",env_location,default_location);
|
||||||
|
@ -206,7 +206,7 @@ int php_init_config(void)
|
||||||
PG(open_basedir) = open_basedir;
|
PG(open_basedir) = open_basedir;
|
||||||
|
|
||||||
if (!cfgin) {
|
if (!cfgin) {
|
||||||
# if WIN32|WINNT
|
# if PHP_WIN32
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
# else
|
# else
|
||||||
return SUCCESS; /* having no configuration file is ok */
|
return SUCCESS; /* having no configuration file is ok */
|
||||||
|
|
|
@ -105,7 +105,7 @@ PHPAPI int php_check_specific_open_basedir(char *basedir, char *path PLS_DC)
|
||||||
|
|
||||||
/* Strip filename */
|
/* Strip filename */
|
||||||
while ((
|
while ((
|
||||||
#if WIN32|WINNT
|
#if PHP_WIN32
|
||||||
(local_open_basedir[local_open_basedir_pos] != '\\') ||
|
(local_open_basedir[local_open_basedir_pos] != '\\') ||
|
||||||
#endif
|
#endif
|
||||||
(local_open_basedir[local_open_basedir_pos] != '/')
|
(local_open_basedir[local_open_basedir_pos] != '/')
|
||||||
|
@ -122,7 +122,7 @@ PHPAPI int php_check_specific_open_basedir(char *basedir, char *path PLS_DC)
|
||||||
/* Resolve the real path into resolved_name */
|
/* Resolve the real path into resolved_name */
|
||||||
if ((php_realpath(path, resolved_name) != NULL) && (php_realpath(local_open_basedir, resolved_basedir) != NULL)) {
|
if ((php_realpath(path, resolved_name) != NULL) && (php_realpath(local_open_basedir, resolved_basedir) != NULL)) {
|
||||||
/* Check the path */
|
/* Check the path */
|
||||||
#if WIN32|WINNT
|
#if PHP_WIN32
|
||||||
if (strncasecmp(resolved_basedir, resolved_name, strlen(resolved_basedir)) == 0) {
|
if (strncasecmp(resolved_basedir, resolved_name, strlen(resolved_basedir)) == 0) {
|
||||||
#else
|
#else
|
||||||
if (strncmp(resolved_basedir, resolved_name, strlen(resolved_basedir)) == 0) {
|
if (strncmp(resolved_basedir, resolved_name, strlen(resolved_basedir)) == 0) {
|
||||||
|
@ -153,7 +153,7 @@ PHPAPI int php_check_open_basedir(char *path)
|
||||||
ptr = pathbuf;
|
ptr = pathbuf;
|
||||||
|
|
||||||
while (ptr && *ptr) {
|
while (ptr && *ptr) {
|
||||||
#if WIN32|WINNT
|
#if PHP_WIN32
|
||||||
end = strchr(ptr, ';');
|
end = strchr(ptr, ';');
|
||||||
#else
|
#else
|
||||||
end = strchr(ptr, ':');
|
end = strchr(ptr, ':');
|
||||||
|
@ -340,7 +340,7 @@ PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **
|
||||||
return fp;
|
return fp;
|
||||||
}
|
}
|
||||||
/* Absolute path open - prepend document_root in safe mode */
|
/* Absolute path open - prepend document_root in safe mode */
|
||||||
#if WIN32|WINNT
|
#if PHP_WIN32
|
||||||
if ((*filename == '\\') || (*filename == '/') || (filename[1] == ':')) {
|
if ((*filename == '\\') || (*filename == '/') || (filename[1] == ':')) {
|
||||||
#else
|
#else
|
||||||
if (*filename == '/') {
|
if (*filename == '/') {
|
||||||
|
@ -381,7 +381,7 @@ PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **
|
||||||
ptr = pathbuf;
|
ptr = pathbuf;
|
||||||
|
|
||||||
while (ptr && *ptr) {
|
while (ptr && *ptr) {
|
||||||
#if WIN32|WINNT
|
#if PHP_WIN32
|
||||||
end = strchr(ptr, ';');
|
end = strchr(ptr, ';');
|
||||||
#else
|
#else
|
||||||
end = strchr(ptr, ':');
|
end = strchr(ptr, ':');
|
||||||
|
|
|
@ -26,14 +26,14 @@
|
||||||
#define USE_PATH 1
|
#define USE_PATH 1
|
||||||
#define IGNORE_URL 2
|
#define IGNORE_URL 2
|
||||||
/* There's no USE_URL. */
|
/* There's no USE_URL. */
|
||||||
#if WIN32|WINNT
|
#if PHP_WIN32
|
||||||
# define IGNORE_URL_WIN 2
|
# define IGNORE_URL_WIN 2
|
||||||
#else
|
#else
|
||||||
# define IGNORE_URL_WIN 0
|
# define IGNORE_URL_WIN 0
|
||||||
#endif
|
#endif
|
||||||
#define ENFORCE_SAFE_MODE 4
|
#define ENFORCE_SAFE_MODE 4
|
||||||
|
|
||||||
#if WIN32|WINNT
|
#if PHP_WIN32
|
||||||
# define SOCK_ERR INVALID_SOCKET
|
# define SOCK_ERR INVALID_SOCKET
|
||||||
# define SOCK_CONN_ERR SOCKET_ERROR
|
# define SOCK_CONN_ERR SOCKET_ERROR
|
||||||
# define SOCK_RECV_ERR SOCKET_ERROR
|
# define SOCK_RECV_ERR SOCKET_ERROR
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
#include "ext/standard/php_standard.h"
|
#include "ext/standard/php_standard.h"
|
||||||
#include "snprintf.h"
|
#include "snprintf.h"
|
||||||
#include "php_variables.h"
|
#include "php_variables.h"
|
||||||
#if WIN32|WINNT
|
#if PHP_WIN32
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include "win32/syslog.h"
|
#include "win32/syslog.h"
|
||||||
|
|
|
@ -60,7 +60,7 @@ static char sccsid[] = "@(#)merge.c 8.2 (Berkeley) 2/14/94";
|
||||||
|
|
||||||
#include "php.h"
|
#include "php.h"
|
||||||
|
|
||||||
#if (WINNT|WIN32)
|
#if (PHP_WIN32)
|
||||||
#include <winsock.h> /* Includes definition for u_char */
|
#include <winsock.h> /* Includes definition for u_char */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
10
main/php.h
10
main/php.h
|
@ -35,6 +35,8 @@
|
||||||
#include "php_version.h"
|
#include "php_version.h"
|
||||||
#include "zend.h"
|
#include "zend.h"
|
||||||
|
|
||||||
|
#define PHP_WIN32 ZEND_WIN32
|
||||||
|
|
||||||
/* automake defines PACKAGE and VERSION for Zend too */
|
/* automake defines PACKAGE and VERSION for Zend too */
|
||||||
#ifdef PACKAGE
|
#ifdef PACKAGE
|
||||||
# undef PACKAGE
|
# undef PACKAGE
|
||||||
|
@ -59,7 +61,7 @@ extern unsigned char second_arg_allow_ref[];
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#if WIN32
|
#if PHP_WIN32
|
||||||
#include "config.w32.h"
|
#include "config.w32.h"
|
||||||
#include "win95nt.h"
|
#include "win95nt.h"
|
||||||
# ifdef PHP_EXPORTS
|
# ifdef PHP_EXPORTS
|
||||||
|
@ -80,7 +82,7 @@ extern unsigned char second_arg_allow_ref[];
|
||||||
#define DEBUG ZEND_DEBUG
|
#define DEBUG ZEND_DEBUG
|
||||||
|
|
||||||
|
|
||||||
#if DEBUG || !(defined(__GNUC__)||defined(WIN32))
|
#if DEBUG || !(defined(__GNUC__)||PHP_WIN32
|
||||||
#ifdef inline
|
#ifdef inline
|
||||||
#undef inline
|
#undef inline
|
||||||
#endif
|
#endif
|
||||||
|
@ -212,7 +214,7 @@ extern char *strerror(int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_PWD_H
|
#if HAVE_PWD_H
|
||||||
# if WIN32||WINNT
|
# if PHP_WIN32
|
||||||
#include "win32/pwd.h"
|
#include "win32/pwd.h"
|
||||||
#include "win32/param.h"
|
#include "win32/param.h"
|
||||||
# else
|
# else
|
||||||
|
@ -288,7 +290,7 @@ extern int ap_vsnprintf(char *, size_t, const char *, va_list);
|
||||||
|
|
||||||
/* global variables */
|
/* global variables */
|
||||||
extern pval *data;
|
extern pval *data;
|
||||||
#if !(WIN32||WINNT)
|
#if !(PHP_WIN32)
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ char *php_realpath(char *path, char resolved_path []) {
|
||||||
char path_copy[MAXPATHLEN]; /* A work-copy of the path */
|
char path_copy[MAXPATHLEN]; /* A work-copy of the path */
|
||||||
char *workpos; /* working position in *path */
|
char *workpos; /* working position in *path */
|
||||||
|
|
||||||
#if !(WIN32|WINNT)
|
#if !(PHP_WIN32)
|
||||||
char buf[MAXPATHLEN]; /* Buffer for readlink */
|
char buf[MAXPATHLEN]; /* Buffer for readlink */
|
||||||
int linklength; /* The result from readlink */
|
int linklength; /* The result from readlink */
|
||||||
#endif
|
#endif
|
||||||
|
@ -48,7 +48,7 @@ char *php_realpath(char *path, char resolved_path []) {
|
||||||
|
|
||||||
struct stat filestat; /* result from stat */
|
struct stat filestat; /* result from stat */
|
||||||
|
|
||||||
#if WIN32|WINNT
|
#if PHP_WIN32
|
||||||
char *temppos; /* position while counting '.' */
|
char *temppos; /* position while counting '.' */
|
||||||
int dotcount; /* number of '.' */
|
int dotcount; /* number of '.' */
|
||||||
int t; /* counter */
|
int t; /* counter */
|
||||||
|
@ -58,7 +58,7 @@ char *php_realpath(char *path, char resolved_path []) {
|
||||||
strcpy(path_copy, path);
|
strcpy(path_copy, path);
|
||||||
workpos = path_copy;
|
workpos = path_copy;
|
||||||
|
|
||||||
#if WIN32|WINNT
|
#if PHP_WIN32
|
||||||
/* Find out where we start - Windows version */
|
/* Find out where we start - Windows version */
|
||||||
if ((*workpos == '\\') || (*workpos == '/')) {
|
if ((*workpos == '\\') || (*workpos == '/')) {
|
||||||
/* We start at the root of the current drive */
|
/* We start at the root of the current drive */
|
||||||
|
@ -109,13 +109,13 @@ char *php_realpath(char *path, char resolved_path []) {
|
||||||
/* Go to the end, then stop */
|
/* Go to the end, then stop */
|
||||||
while(*workpos != 0) {
|
while(*workpos != 0) {
|
||||||
/* Strip (back)slashes */
|
/* Strip (back)slashes */
|
||||||
#if WIN32|WINNT
|
#if PHP_WIN32
|
||||||
while(*workpos == '\\') workpos++;
|
while(*workpos == '\\') workpos++;
|
||||||
#else
|
#else
|
||||||
while(*workpos == '/') workpos++;
|
while(*workpos == '/') workpos++;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if WIN32|WINNT
|
#if PHP_WIN32
|
||||||
/* reset dotcount */
|
/* reset dotcount */
|
||||||
dotcount = 0;
|
dotcount = 0;
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ char *php_realpath(char *path, char resolved_path []) {
|
||||||
*writepos++ = *workpos++;
|
*writepos++ = *workpos++;
|
||||||
}
|
}
|
||||||
*writepos = 0;
|
*writepos = 0;
|
||||||
#else /* WIN32|WINNT */
|
#else /* PHP_WIN32 */
|
||||||
/* Look for .. */
|
/* Look for .. */
|
||||||
if ((workpos[0] == '.') && (workpos[1] != 0)) {
|
if ((workpos[0] == '.') && (workpos[1] != 0)) {
|
||||||
if ((workpos[1] == '.') && ((workpos[2] == '/') || (workpos[2] == 0))) {
|
if ((workpos[1] == '.') && ((workpos[2] == '/') || (workpos[2] == 0))) {
|
||||||
|
@ -247,7 +247,7 @@ char *php_realpath(char *path, char resolved_path []) {
|
||||||
*writepos++ = *workpos++;
|
*writepos++ = *workpos++;
|
||||||
}
|
}
|
||||||
*writepos = 0;
|
*writepos = 0;
|
||||||
#endif /* WIN32|WINNT */
|
#endif /* PHP_WIN32 */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if the resolved path is a directory */
|
/* Check if the resolved path is a directory */
|
||||||
|
|
|
@ -34,7 +34,7 @@ int php_init_request_info(void *conf)
|
||||||
if (!request_info.script_filename) {
|
if (!request_info.script_filename) {
|
||||||
request_info.script_filename = request_info.php_argv0;
|
request_info.script_filename = request_info.php_argv0;
|
||||||
}
|
}
|
||||||
#if WIN32|WINNT
|
#if PHP_WIN32
|
||||||
/* FIXME WHEN APACHE NT IS FIXED */
|
/* FIXME WHEN APACHE NT IS FIXED */
|
||||||
/* a hack for apache nt because it does not appear to set argv[1] and sets
|
/* a hack for apache nt because it does not appear to set argv[1] and sets
|
||||||
script filename to php.exe thus makes us parse php.exe instead of file.php
|
script filename to php.exe thus makes us parse php.exe instead of file.php
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue