The PHP Interpreter https://www.php.net
Find a file
Calvin Buckley 76791e90b9
Use win32 glob implementation on all platforms (#18164)
* Move glob to main/ from win32/

In preparation to make the Win32 reimplementation the standard
cross-platform one. Currently, it doesn't do that and just passes
through the original glob implementation. We could consider also having
an option to use the standard glob for systems that have a sufficient
one.

* Enable building with win32 glob on non-windows

Kind of broken. We're namespacing the function and struct, but not yet
the GLOB_* defines. There are a lot of places callers check if i.e.
NOMATCH is defined that would likely become redundant.

Currently it also has php_glob and #defines glob php_glob (etc.) - I
suspect doing the opposite and changing the callers would make more
sense, just doing MVP to geet it to build (even if it fails tests).

* Massive first pass at conversion to internal glob

Have not tested yet. the big things are:

- Should be invisible to userland PHP code.
- A lot of :%s/GLOB_/PHP_GLOB_/g; the diff can be noisy as a result,
  especially in comments.
- Prefixes everything with PHP_ to avoid conflicts with system glob in
  case it gets included transitively.
- A lot of weird shared definitions that were sprawled out to other
  headers are now included in php_glob.h.
- A lot of (but not yet all cases) of HAVE_GLOB are removed, since we
  can always fall back to php_glob.
- Using the system glob is not wired up yet; it'll need more shim
  ifdefs for each flag type than just glob_t/glob/globfree defs.

* Fix inclusion of GLOB_ONLYDIR

This is a GNU extension, but we don't need to implement it, as the GNU
implementation is flawed enough that callers have to manually filter it
anyways; just provide a stub definition for the constant.

We could consideer implementing this properly later. For now, fixes the
basic glob constant tests.

* Remove HAVE_GLOBs

We now always have a glob implementation that works. HAVE_GLOB should
only be used to check if we have a system implementation, for if we
decide to wrap the system implementation instead.

* We don't need to care about being POSIXly correct for internal glob

* Check for reallocarray

Ideally temporary until GH-17433.

* Forgot to move this file from win32/ to main/

* Check for issetugid (BSD function)

* Allow using the system glob with --enable-system-glob

* Style fix after removing ifdef

* Remove empty case for system glob
2025-05-20 16:20:59 -03:00
.circleci Merge branch 'PHP-8.3' into PHP-8.4 2025-03-10 13:38:16 +01:00
.github [skip ci] Do not interpret PHP version in bug_report.yml as markdown (#18492) 2025-05-04 13:14:47 +02:00
benchmark Merge branch 'PHP-8.3' into PHP-8.4 2025-03-30 00:45:03 +01:00
build Merge branch 'PHP-8.4' 2025-05-09 13:33:58 +02:00
docs [RFC] Add support for attributes on compile-time constants 2025-04-29 11:53:09 -07:00
docs-old Autotools: Normalize and quote all PHP_NEW_EXTENSION arguments (#15144) 2024-07-29 00:14:59 +02:00
ext Use win32 glob implementation on all platforms (#18164) 2025-05-20 16:20:59 -03:00
main Use win32 glob implementation on all platforms (#18164) 2025-05-20 16:20:59 -03:00
pear Update PEAR failed download installation banner (#14216) 2024-05-13 19:01:05 +02:00
sapi Use win32 glob implementation on all platforms (#18164) 2025-05-20 16:20:59 -03:00
scripts GDB: replace match statements with if statements in gdb debug script so it works with lower versions (#18226) 2025-04-02 11:56:16 +02:00
tests [skip ci] Fix tests with multiline titles (GH-17763) 2025-02-14 12:03:53 +01:00
TSRM Drop unused local variables (GH-17682) 2025-02-03 16:42:29 +01:00
win32 Use win32 glob implementation on all platforms (#18164) 2025-05-20 16:20:59 -03:00
Zend Use win32 glob implementation on all platforms (#18164) 2025-05-20 16:20:59 -03:00
.editorconfig Improve php-src docs sphinx build, also on *nix (GH-16743) 2024-11-29 19:29:00 +01:00
.gdbinit Merge branch 'PHP-8.2' into PHP-8.3 2024-01-23 12:55:47 +01:00
.gitattributes Fix path for main/debug_gdb_scripts.c in .gitattributes 2025-04-02 10:38:28 +02:00
.gitignore run-tests.php: Save STDIN section into a file (#18305) 2025-04-15 14:02:08 +02:00
buildconf Merge branch 'PHP-8.2' into PHP-8.3 2024-11-09 14:05:38 +01:00
buildconf.bat Fix #79146: cscript can fail to run on some systems 2020-01-21 11:53:11 +01:00
codecov.yml Implement CSS selectors 2024-06-29 13:00:26 -07:00
CODING_STANDARDS.md [skip ci] Bump required C standard to C11 2024-09-27 12:37:20 +02:00
configure.ac Use win32 glob implementation on all platforms (#18164) 2025-05-20 16:20:59 -03:00
CONTRIBUTING.md Document contributor certification in CONTRIBUTING.md [skip ci] (#18356) 2025-05-01 16:30:48 +01:00
EXTENSIONS Merge branch 'PHP-8.4' 2025-05-06 22:07:11 +02:00
LICENSE Update year to 2024 2024-01-04 19:26:32 +01:00
NEWS Merge branch 'PHP-8.3' into PHP-8.4 2025-05-20 08:08:39 +02:00
php.ini-development Fix GH-17645: FPM with httpd ProxyPass does not decode script path 2025-03-25 19:19:55 +01:00
php.ini-production Fix GH-17645: FPM with httpd ProxyPass does not decode script path 2025-03-25 19:19:55 +01:00
README.md Remove Travis artefacts (#15714) 2024-09-04 01:15:10 +02:00
README.REDIST.BINS hash: Add SHA-NI implementation of SHA-256 (#15152) 2024-08-08 22:19:33 +02:00
run-tests.php run-tests.php: Remove extra env vars in the generated .sh file (#18306) 2025-04-29 10:59:10 +02:00
SECURITY.md Move most of this to https://github.com/php/policies as per Policies RFC 2024-01-30 17:31:55 +00:00
UPGRADING Improve performance of instantiating exceptions/errors (#18442) 2025-05-19 20:24:44 +02:00
UPGRADING.INTERNALS standard: Remove php_std_date() C API (#18522) 2025-05-12 10:53:51 +02:00

The PHP Interpreter

PHP is a popular general-purpose scripting language that is especially suited to web development. Fast, flexible and pragmatic, PHP powers everything from your blog to the most popular websites in the world. PHP is distributed under the PHP License v3.01.

Push Fuzzing Status

Documentation

The PHP manual is available at php.net/docs.

Installation

Prebuilt packages and binaries

Prebuilt packages and binaries can be used to get up and running fast with PHP.

For Windows, the PHP binaries can be obtained from windows.php.net. After extracting the archive the *.exe files are ready to use.

For other systems, see the installation chapter.

Building PHP source code

For Windows, see Build your own PHP on Windows.

For a minimal PHP build from Git, you will need autoconf, bison, and re2c. For a default build, you will additionally need libxml2 and libsqlite3.

On Ubuntu, you can install these using:

sudo apt install -y pkg-config build-essential autoconf bison re2c \
                    libxml2-dev libsqlite3-dev

On Fedora, you can install these using:

sudo dnf install re2c bison autoconf make libtool ccache libxml2-devel sqlite-devel

Generate configure:

./buildconf

Configure your build. --enable-debug is recommended for development, see ./configure --help for a full list of options.

# For development
./configure --enable-debug
# For production
./configure

Build PHP. To speed up the build, specify the maximum number of jobs using -j:

make -j4

The number of jobs should usually match the number of available cores, which can be determined using nproc.

Testing PHP source code

PHP ships with an extensive test suite, the command make test is used after successful compilation of the sources to run this test suite.

It is possible to run tests using multiple cores by setting -jN in TEST_PHP_ARGS:

make TEST_PHP_ARGS=-j4 test

Shall run make test with a maximum of 4 concurrent jobs: Generally the maximum number of jobs should not exceed the number of cores available.

The qa.php.net site provides more detailed info about testing and quality assurance.

Installing PHP built from source

After a successful build (and test), PHP may be installed with:

make install

Depending on your permissions and prefix, make install may need super user permissions.

PHP extensions

Extensions provide additional functionality on top of PHP. PHP consists of many essential bundled extensions. Additional extensions can be found in the PHP Extension Community Library - PECL.

Contributing

The PHP source code is located in the Git repository at github.com/php/php-src. Contributions are most welcome by forking the repository and sending a pull request.

Discussions are done on GitHub, but depending on the topic can also be relayed to the official PHP developer mailing list internals@lists.php.net.

New features require an RFC and must be accepted by the developers. See Request for comments - RFC and Voting on PHP features for more information on the process.

Bug fixes don't require an RFC. If the bug has a GitHub issue, reference it in the commit message using GH-NNNNNN. Use #NNNNNN for tickets in the old bugs.php.net bug tracker.

Fix GH-7815: php_uname doesn't recognise latest Windows versions
Fix #55371: get_magic_quotes_gpc() throws deprecation warning

See Git workflow for details on how pull requests are merged.

Guidelines for contributors

See further documents in the repository for more information on how to contribute:

Credits

For the list of people who've put work into PHP, please see the PHP credits page.