linux 版本 : ubuntu 12.04
今天完成了 php mysql 和apache 的配置
主要是源码配置,
apache 主要是 2.4.2 版本
php 主要是 5.3.11 版本
mysql 主要是 5.1.62 版本
前几天试了好几次,出现了软件的源冲突,我放了两个源在同一个source里,后修改后,安装没出现大的问题。
总的情况如下.
我完成的过程如下 :
apache 配置:
./configure --prefix=/usr/local/apache/ --with-libxml2 --enable-modules
=most --enable-mods-shared=all
看这apache 经典实例写的。
在ubuntu上加上libxml2最新的版本,然后一切ok
make
make install
然后 输入127.0.0.1 可以看见it‘s work!
mysql配置:
cd mysql
sudo ./configure –prefix=/usr/local/mysql –with-mysqld-user=mysql
–with-extra-charsets=all –enable-thread-safe-client
在./configure 配置中小心点,并且小心其中的提示
我便是在小中度过那个./configure 的,然后就是顺利的
make
make install
由于要配置文件复制到etc目录下
sudo cp /mypath/mysql /etc/my.cnf
[mysqld]# 设置默认为INNODB表,支持事务:default-storage-engine=INNODB
# 设置默认的字符集UTF-8:
character-set-server=utf8
collation-server=utf8_general_ci
default-character-set=utf8
# mysql启动用户
user=mysql
[client]
default-character-set=utf8
为了让普通的用户启动mysql 赋予mysql目录如下权限
sudo chown -R mysql:mysql /usr/local/mysql
然后,切换到mysql的用户下,发现mysql启动了
ps aux | grep mysqld
如果有 /usr/local/mysql/bin/ 。。。 说明启动了mysql,mysql配置ok
在
Php 配置:
最复杂的属php的配置,关键在于那个模块有点多
配置和安装的时间有点长,有时候 我还认为是死机呢?
./configure --prefix=/usr/local/php \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-mysql-dir=/usr/local/mysql \
--with-mysql-sock=/tmp/mysql.sock \
--with-pdo-mysql=/usr/local/mysql \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--enable-mod-charset \
--enable-bcmath \
--with-bz2 \
--enable-calendar \
--with-curl \
--with-curlwrappers \
--enable-exif \
--enable-ftp \
--with-gdbm \
--with-gd=shared \
--with-ttf \
--enable-gd-native-ttf \
--with-gettext \
--with-gmp \
--enable-mbstring=all \
--enable-zend-multibyte \
--with-ming=shared \
--enable-sqlite-utf8 \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-xmlrpc \
--with-xsl \
--enable-zip \
--with-zlib \
--enable-discard-path \
--enable-force-cgi-redirect \
--enable-magic-quotes \
--enable-sigchild \
--with-ncurses \
--enable-pcntl
然后configure中报出缺少好多组件,唉。。 一个一个填上 例如 bz2 和zlib 和ncurses 三个组件添加完后
configure 立即成功了,然后呢? make ok make test 出问题。。。。。?? 无语了但是 make install
ok
就需要对php 配置了
建立 php.ini 文件。
写入如下的配置:
error_log = /usr/local/php/php_error.log
date.timezone = "Asia/ShangHai"
session.save_path = "/tmp"
对conf/httpd.conf 修改在 LoadModules php5_modules modules/libphp5.so 填上
AddType application/x-httpd-php .php .html
AddType application/x-httpd-php-source .phps
apache其他配置信息也写在httpd.conf文件里。例如 主目录位置:

PHP remains important in modern web development, especially in content management and e-commerce platforms. 1) PHP has a rich ecosystem and strong framework support, such as Laravel and Symfony. 2) Performance optimization can be achieved through OPcache and Nginx. 3) PHP8.0 introduces JIT compiler to improve performance. 4) Cloud-native applications are deployed through Docker and Kubernetes to improve flexibility and scalability.

PHP is suitable for web development, especially in rapid development and processing dynamic content, but is not good at data science and enterprise-level applications. Compared with Python, PHP has more advantages in web development, but is not as good as Python in the field of data science; compared with Java, PHP performs worse in enterprise-level applications, but is more flexible in web development; compared with JavaScript, PHP is more concise in back-end development, but is not as good as JavaScript in front-end development.

PHP and Python each have their own advantages and are suitable for different scenarios. 1.PHP is suitable for web development and provides built-in web servers and rich function libraries. 2. Python is suitable for data science and machine learning, with concise syntax and a powerful standard library. When choosing, it should be decided based on project requirements.

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7

The reasons why PHP is the preferred technology stack for many websites include its ease of use, strong community support, and widespread use. 1) Easy to learn and use, suitable for beginners. 2) Have a huge developer community and rich resources. 3) Widely used in WordPress, Drupal and other platforms. 4) Integrate tightly with web servers to simplify development deployment.

PHP remains a powerful and widely used tool in modern programming, especially in the field of web development. 1) PHP is easy to use and seamlessly integrated with databases, and is the first choice for many developers. 2) It supports dynamic content generation and object-oriented programming, suitable for quickly creating and maintaining websites. 3) PHP's performance can be improved by caching and optimizing database queries, and its extensive community and rich ecosystem make it still important in today's technology stack.

In PHP, weak references are implemented through the WeakReference class and will not prevent the garbage collector from reclaiming objects. Weak references are suitable for scenarios such as caching systems and event listeners. It should be noted that it cannot guarantee the survival of objects and that garbage collection may be delayed.

The \_\_invoke method allows objects to be called like functions. 1. Define the \_\_invoke method so that the object can be called. 2. When using the $obj(...) syntax, PHP will execute the \_\_invoke method. 3. Suitable for scenarios such as logging and calculator, improving code flexibility and readability.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 English version
Recommended: Win version, supports code prompts!

SublimeText3 Mac version
God-level code editing software (SublimeText3)