PHP
lastmod 2025-09-03created 2014-01-0558 edits
| PHP Basic
PHP Forms
PHP Advanced
PHP Database
PHP XML
PHP and AJAX
PHP Examples
PHP Reference
|
Categories
- Alternative PHP Cache (APC)
- Suhosin
- Laravel
- QuickPHP
- phpenv - Virtual environment
- Composer - Package manager
- FrankenPHP - A modern PHP app server written in Go
Libraries
- php-crud-api - Add a REST API to a DB with a single file
- slime - A small api framework with Slim v3 +Eloquent, to create easily Restful services
ETC
- php-node - A handler that processes PHP HTTP requests inside Node.js
Functions
-
get_current_user(): Returns the name of the owner of the current PHP script. -
var_dump($var): This function displays structured information about one or more expressions, including their type and value. Arrays and objects are explored recursively to show their structure. -
is_writable($filename): Returns TRUE if the filename exists and is writable. -
posix_getuid(): Return the numeric real user ID of the current process. -
debug_print_backtrace(): prints a PHP backtrace.
How to instasll
- See also: MediaWiki:Install#CentOS_7
Install PHP:
MySQL module:
Common PHP modules:
$ yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel
Ubuntu
sudo apt-get install apache2 libapache2-mod-php5
## libapache2-mod-php5 provides the following PHP extensions: bcmath bz2 calendar Core ctype date dba dom ereg exif fileinfo filter ftp gettext hash iconv libxml mbstring mhash openssl pcre Phar posix Reflection session shmop SimpleXML soap sockets SPL standard sysvmsg sysvsem sysvshm tokenizer wddx xml xmlreader xmlwriter zip zlib.
Recommended Modules:
$ apt-get install php5-gd php5-json php5-mysql php5-curl
$ apt-get install php5-intl php5-mcrypt php5-imagick
Configuration
Notes on how to configure PHP.
How to find PHP configuration file information
You can get information such as PHP's INI file.
Setting the PHP file upload size limit
Edit the variables below in php.ini. 1
Allowing PHP short tags
By default, PHP does not allow short tags such as <? ... ?>. Short tags are not recommended because they clash with XML expressions like the one below.
- <code><?xml version="1.0" encoding="UTF-8"?>
</code>
If you still want to use short tags, do the following.
register_globals
With rester_globals set to ON, you do not need to check whether a variable is a get, post, or session variable. Depending on how it is used, this can cause security problems.
-
register_globals = on- Allowed:
$_POST['u_id'] - Allowed:
$u_id
- Allowed:
register_globals = off- Allowed:
$_POST['u_id'] - Not allowed:
$u_id - Possible if handled with
extrract().
How to install extension libraries
- Pecl Intl
- Installing/enabling PHP Pecl Intl extension on CentOs 5
-
yum install php-intl
- PHP sqlite3
- Not Installing Sqlite 3 on CentOS correctly
-
yum install php-pdo
Troubleshooting
Notes on solving problems that can occur while using PHP.
Fatal exception of type MWException Error
To print detailed error logs, add the Setting variable as below.
Not working phpinfo()
You can use the phpinfo() function as below.
But if it does not print correctly, change it as below.
See also
Favorite site
- php website
- PHP Manual
- How to install Alternative PHP Cache
- How to install PECL
- Setting up PHP acceleration with APC (Alternative PHP Cache) and XCache
- [Recommended] Catching up on PHP with Downy
PHP Framwork
- Building your own MVC Framework in PHP Part 1
- Reviewing PHP frameworks
- Don't use a PHP framework (ends up recommending codeigniter)
PHP Security
- 30 PHP security tips you must know
- Linux php security 2
- KLDP: A PHP security officer finally made up his mind and resigned 3
- How to solve security problems in PHP: a look at the ever-present threats SQLi, XSS & CSRF
- Implementing a PHP login program
- Top 5 PHP web security vulnerabilities (web hacking)
- 20 PHP security tips you must know
- PHP Manual Database security
- KLDP: A PHP security officer finally made up his mind and resigned
- KLDP: Investigation concludes PHP security cannot be fixed
PEAR and PECL
- Installing PEAR on OSX 10.9 Mavericks and OSX10.8/10.7
- Install PEAR and PECL on Mac OS X
- Install PECL on Mac OS X 10.6
PHP Install
- PHP 5.3/5.4/5.5 for OS X 10.6/10.7/10.8/10.9 as binary package
- $PHP_AUTOCONF errors on mac os x 10.7.3 when trying to install pecl extensions
- [Recommended] Compiling 64-bit Apache/PHP on Mac OS X 10.5.6
- Attaching PHP Development Tool (PDT) to Eclipse
Debugging
- Debugging PHP by installing xDebug
- Debugging with FirePHP in the PHP console
- XDEBUG EXTENSION FOR PHP | DOCUMENTATION
Article
- [http://haah.kr/2020/10/24/php-annotated-october-2020/](http://haah.kr/2020/10/24/php-annotated-october-2020/) (Korean translation)
- The Rise of Hybrid PHP: Combining PHP with Go and Rust | GeekNews
- [Original] yekdeveloper - The Rise of Hybrid PHP: Blending PHP with Go and Rust
- A hybrid approach that integrates Go and Rust as extension languages within a PHP monolith has recently drawn attention
- Previously, a combination of Go microservices and a PHP 8.3 monolith achieved a balance of productivity and high performance
- Following the Pareto principle (80% of traffic concentrated on 20% of APIs), optimizing hotspot endpoints was essential; in the past this was handled with caching and splitting out Go services, but complexity grew
- Recent advances in the PHP ecosystem have brought techniques such as FFI, Rust extensions, and Go extensions (FrankenPHP), making it possible to greatly improve performance inside the monolith
- Rust extensions provide both memory safety and speed, and FrankenPHP shows performance gains of up to 4x or more with worker mode and Go-based extensions
- The hybrid PHP approach secures both productivity and speed while avoiding the cost and risk of rewriting everything in Go/Rust
References
- Alternative PHP Cache
- Apache httpd
- Apache:Httpd:HowToInstall
- APM
- APM Stack
- Composer
- Computer Language
- CRUD
- Drupal
- FrankenPHP
- Here document
- Infrastructure
- Jade
- Kubernetes:Basic
- Mustache
- MySql
- Nunjucks
- Package management system
- Php-crud-api
- Php-node
- Programming language
- Rough Auditing Tool for Security
- Scripting Language
- Solution stack
- Twig
- Web development
- Web template system
- WordPress
- XAMPP