How to build PHP 7.3?
I have a problem with building the package for PHP 7.3 from git. At the moment I am using Ubuntu 16.04 with utdatet php 7.0.x. (It's impossible to upgrade Ubuntu 16.04 to 18.04 at my VPS, because it crashes at boot. I only have Virtuozzo to debug and I can't find the point where it crashes, so upgrading to 18.04 isn't an option yet.)
My steps so far:
I have installed all programs for build, (git, build essential, libtool, bison and re2c).
I cloned the git from GitHub with:
git clone https://github.com/php/php-src.git
Then I selected the branch I want:
git checkout PHP-7.3
Then I ran:
./buildconf
What is the next step?
I need the following packages:
php7.3
libapache2-mod-php7.3
php7.3-mysql
mysql-server
I didn't search for a PPA, because I wanted to do it on my own in order to learn by doing it.
server apache2 php compiling git
add a comment |
I have a problem with building the package for PHP 7.3 from git. At the moment I am using Ubuntu 16.04 with utdatet php 7.0.x. (It's impossible to upgrade Ubuntu 16.04 to 18.04 at my VPS, because it crashes at boot. I only have Virtuozzo to debug and I can't find the point where it crashes, so upgrading to 18.04 isn't an option yet.)
My steps so far:
I have installed all programs for build, (git, build essential, libtool, bison and re2c).
I cloned the git from GitHub with:
git clone https://github.com/php/php-src.git
Then I selected the branch I want:
git checkout PHP-7.3
Then I ran:
./buildconf
What is the next step?
I need the following packages:
php7.3
libapache2-mod-php7.3
php7.3-mysql
mysql-server
I didn't search for a PPA, because I wanted to do it on my own in order to learn by doing it.
server apache2 php compiling git
add a comment |
I have a problem with building the package for PHP 7.3 from git. At the moment I am using Ubuntu 16.04 with utdatet php 7.0.x. (It's impossible to upgrade Ubuntu 16.04 to 18.04 at my VPS, because it crashes at boot. I only have Virtuozzo to debug and I can't find the point where it crashes, so upgrading to 18.04 isn't an option yet.)
My steps so far:
I have installed all programs for build, (git, build essential, libtool, bison and re2c).
I cloned the git from GitHub with:
git clone https://github.com/php/php-src.git
Then I selected the branch I want:
git checkout PHP-7.3
Then I ran:
./buildconf
What is the next step?
I need the following packages:
php7.3
libapache2-mod-php7.3
php7.3-mysql
mysql-server
I didn't search for a PPA, because I wanted to do it on my own in order to learn by doing it.
server apache2 php compiling git
I have a problem with building the package for PHP 7.3 from git. At the moment I am using Ubuntu 16.04 with utdatet php 7.0.x. (It's impossible to upgrade Ubuntu 16.04 to 18.04 at my VPS, because it crashes at boot. I only have Virtuozzo to debug and I can't find the point where it crashes, so upgrading to 18.04 isn't an option yet.)
My steps so far:
I have installed all programs for build, (git, build essential, libtool, bison and re2c).
I cloned the git from GitHub with:
git clone https://github.com/php/php-src.git
Then I selected the branch I want:
git checkout PHP-7.3
Then I ran:
./buildconf
What is the next step?
I need the following packages:
php7.3
libapache2-mod-php7.3
php7.3-mysql
mysql-server
I didn't search for a PPA, because I wanted to do it on my own in order to learn by doing it.
server apache2 php compiling git
server apache2 php compiling git
edited Jan 21 at 1:18
karel
58.6k13128147
58.6k13128147
asked Dec 18 '18 at 19:14
roketroket
133
133
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Install dependencies.
sudo apt install autoconf automake bison build-essential curl flex
libtool libssl-dev libcurl4-openssl-dev libxml2-dev libreadline7
libreadline-dev libsqlite3-dev libzip-dev libzip4 nginx openssl
pkg-config re2c sqlite3 zlib1g-dev
So you don't overwrite any existing PHP installs on your system, install PHP in your home directory. Create a directory for the PHP binaries.
mkdir -p ~/bin/php7-latest/
Download the PHP 7.3 from GitHub, decompress it, then change directories using
cd
to the new directory. You can also download PHP 7.3 from php.net/downloads.php and the installation instructions are exactly the same. Ordinarily this would be the preferred way of downloading PHP 7.3, but I'm using PHP 7.3 from https://github.com/php/ in this answer instead in order to match the PHP 7.3 archive that is asked about in the question.
Configure PHP. Remove any options you don't need (like MySQL or Postgres (--with-pdo-pgsql))
./configure --prefix=$HOME/bin/php-latest
--enable-mysqlnd
--with-pdo-mysql
--with-pdo-mysql=mysqlnd
--with-pdo-pgsql=/usr/bin/pg_config
--enable-bcmath
--enable-fpm
--with-fpm-user=www-data
--with-fpm-group=www-data
--enable-mbstring
--enable-phpdbg
--enable-shmop
--enable-sockets
--enable-sysvmsg
--enable-sysvsem
--enable-sysvshm
--enable-zip
--with-libzip=/usr/lib/x86_64-linux-gnu
--with-zlib
--with-curl
--with-pear
--with-openssl
--enable-pcntl
--with-readline
Probably you won't need to remove any of the options except for
--with-pdo-pgsql=/usr/bin/pg_config
if PostgreSQL isn't installed. If you don't remove an option that is specific to a package that isn't installed, then this command will return an error message that tells you what option must be removed so that the command will run successfully.
Compile the binaries:
make # wait until make is finished
make install
Copy the PHP.ini file to the install directory
cp php.ini-development ~/bin/php-latest/lib/
Rename two files.
cd ~/bin/php-latest/etc/
mv php-fpm.conf.default php-fpm.conf
mv php-fpm.d/www.conf.default php-fpm.d/www.conf
Create symbolic links for your for your binary file.
cd ~/bin
ln -s php-latest/bin/php php
ln -s php-latest/bin/php-cgi php-cgi
ln -s php-latest/bin/php-config php-config
ln -s php-latest/bin/phpize phpize
ln -s php-latest/bin/phar.phar phar
ln -s php-latest/bin/pear pear
ln -s php-latest/bin/phpdbg phpdbg
ln -s php-latest/sbin/php-fpm php-fpm
Link your local PHP to the php command. You will need to logout then log back in for php to switch to the local version instead of the installed version from the default Ubuntu repositories.
# add this to .bashrc
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
Start PHP-FPM
sudo ~/bin/php-latest/sbin/php-fpm
If you run the above command as normal user without sudo, it will show the following notices:
NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root.
NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root.
Source: The Install file in php-src-master directory from https://github.com/php/php-src.git contains a link to https://php.net/install from which source these instructions were revised. In addition to several small revisions I added information about how to install PHP 7.3 locally in your home directory without requiring root permissions.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1102910%2fhow-to-build-php-7-3%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Install dependencies.
sudo apt install autoconf automake bison build-essential curl flex
libtool libssl-dev libcurl4-openssl-dev libxml2-dev libreadline7
libreadline-dev libsqlite3-dev libzip-dev libzip4 nginx openssl
pkg-config re2c sqlite3 zlib1g-dev
So you don't overwrite any existing PHP installs on your system, install PHP in your home directory. Create a directory for the PHP binaries.
mkdir -p ~/bin/php7-latest/
Download the PHP 7.3 from GitHub, decompress it, then change directories using
cd
to the new directory. You can also download PHP 7.3 from php.net/downloads.php and the installation instructions are exactly the same. Ordinarily this would be the preferred way of downloading PHP 7.3, but I'm using PHP 7.3 from https://github.com/php/ in this answer instead in order to match the PHP 7.3 archive that is asked about in the question.
Configure PHP. Remove any options you don't need (like MySQL or Postgres (--with-pdo-pgsql))
./configure --prefix=$HOME/bin/php-latest
--enable-mysqlnd
--with-pdo-mysql
--with-pdo-mysql=mysqlnd
--with-pdo-pgsql=/usr/bin/pg_config
--enable-bcmath
--enable-fpm
--with-fpm-user=www-data
--with-fpm-group=www-data
--enable-mbstring
--enable-phpdbg
--enable-shmop
--enable-sockets
--enable-sysvmsg
--enable-sysvsem
--enable-sysvshm
--enable-zip
--with-libzip=/usr/lib/x86_64-linux-gnu
--with-zlib
--with-curl
--with-pear
--with-openssl
--enable-pcntl
--with-readline
Probably you won't need to remove any of the options except for
--with-pdo-pgsql=/usr/bin/pg_config
if PostgreSQL isn't installed. If you don't remove an option that is specific to a package that isn't installed, then this command will return an error message that tells you what option must be removed so that the command will run successfully.
Compile the binaries:
make # wait until make is finished
make install
Copy the PHP.ini file to the install directory
cp php.ini-development ~/bin/php-latest/lib/
Rename two files.
cd ~/bin/php-latest/etc/
mv php-fpm.conf.default php-fpm.conf
mv php-fpm.d/www.conf.default php-fpm.d/www.conf
Create symbolic links for your for your binary file.
cd ~/bin
ln -s php-latest/bin/php php
ln -s php-latest/bin/php-cgi php-cgi
ln -s php-latest/bin/php-config php-config
ln -s php-latest/bin/phpize phpize
ln -s php-latest/bin/phar.phar phar
ln -s php-latest/bin/pear pear
ln -s php-latest/bin/phpdbg phpdbg
ln -s php-latest/sbin/php-fpm php-fpm
Link your local PHP to the php command. You will need to logout then log back in for php to switch to the local version instead of the installed version from the default Ubuntu repositories.
# add this to .bashrc
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
Start PHP-FPM
sudo ~/bin/php-latest/sbin/php-fpm
If you run the above command as normal user without sudo, it will show the following notices:
NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root.
NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root.
Source: The Install file in php-src-master directory from https://github.com/php/php-src.git contains a link to https://php.net/install from which source these instructions were revised. In addition to several small revisions I added information about how to install PHP 7.3 locally in your home directory without requiring root permissions.
add a comment |
Install dependencies.
sudo apt install autoconf automake bison build-essential curl flex
libtool libssl-dev libcurl4-openssl-dev libxml2-dev libreadline7
libreadline-dev libsqlite3-dev libzip-dev libzip4 nginx openssl
pkg-config re2c sqlite3 zlib1g-dev
So you don't overwrite any existing PHP installs on your system, install PHP in your home directory. Create a directory for the PHP binaries.
mkdir -p ~/bin/php7-latest/
Download the PHP 7.3 from GitHub, decompress it, then change directories using
cd
to the new directory. You can also download PHP 7.3 from php.net/downloads.php and the installation instructions are exactly the same. Ordinarily this would be the preferred way of downloading PHP 7.3, but I'm using PHP 7.3 from https://github.com/php/ in this answer instead in order to match the PHP 7.3 archive that is asked about in the question.
Configure PHP. Remove any options you don't need (like MySQL or Postgres (--with-pdo-pgsql))
./configure --prefix=$HOME/bin/php-latest
--enable-mysqlnd
--with-pdo-mysql
--with-pdo-mysql=mysqlnd
--with-pdo-pgsql=/usr/bin/pg_config
--enable-bcmath
--enable-fpm
--with-fpm-user=www-data
--with-fpm-group=www-data
--enable-mbstring
--enable-phpdbg
--enable-shmop
--enable-sockets
--enable-sysvmsg
--enable-sysvsem
--enable-sysvshm
--enable-zip
--with-libzip=/usr/lib/x86_64-linux-gnu
--with-zlib
--with-curl
--with-pear
--with-openssl
--enable-pcntl
--with-readline
Probably you won't need to remove any of the options except for
--with-pdo-pgsql=/usr/bin/pg_config
if PostgreSQL isn't installed. If you don't remove an option that is specific to a package that isn't installed, then this command will return an error message that tells you what option must be removed so that the command will run successfully.
Compile the binaries:
make # wait until make is finished
make install
Copy the PHP.ini file to the install directory
cp php.ini-development ~/bin/php-latest/lib/
Rename two files.
cd ~/bin/php-latest/etc/
mv php-fpm.conf.default php-fpm.conf
mv php-fpm.d/www.conf.default php-fpm.d/www.conf
Create symbolic links for your for your binary file.
cd ~/bin
ln -s php-latest/bin/php php
ln -s php-latest/bin/php-cgi php-cgi
ln -s php-latest/bin/php-config php-config
ln -s php-latest/bin/phpize phpize
ln -s php-latest/bin/phar.phar phar
ln -s php-latest/bin/pear pear
ln -s php-latest/bin/phpdbg phpdbg
ln -s php-latest/sbin/php-fpm php-fpm
Link your local PHP to the php command. You will need to logout then log back in for php to switch to the local version instead of the installed version from the default Ubuntu repositories.
# add this to .bashrc
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
Start PHP-FPM
sudo ~/bin/php-latest/sbin/php-fpm
If you run the above command as normal user without sudo, it will show the following notices:
NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root.
NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root.
Source: The Install file in php-src-master directory from https://github.com/php/php-src.git contains a link to https://php.net/install from which source these instructions were revised. In addition to several small revisions I added information about how to install PHP 7.3 locally in your home directory without requiring root permissions.
add a comment |
Install dependencies.
sudo apt install autoconf automake bison build-essential curl flex
libtool libssl-dev libcurl4-openssl-dev libxml2-dev libreadline7
libreadline-dev libsqlite3-dev libzip-dev libzip4 nginx openssl
pkg-config re2c sqlite3 zlib1g-dev
So you don't overwrite any existing PHP installs on your system, install PHP in your home directory. Create a directory for the PHP binaries.
mkdir -p ~/bin/php7-latest/
Download the PHP 7.3 from GitHub, decompress it, then change directories using
cd
to the new directory. You can also download PHP 7.3 from php.net/downloads.php and the installation instructions are exactly the same. Ordinarily this would be the preferred way of downloading PHP 7.3, but I'm using PHP 7.3 from https://github.com/php/ in this answer instead in order to match the PHP 7.3 archive that is asked about in the question.
Configure PHP. Remove any options you don't need (like MySQL or Postgres (--with-pdo-pgsql))
./configure --prefix=$HOME/bin/php-latest
--enable-mysqlnd
--with-pdo-mysql
--with-pdo-mysql=mysqlnd
--with-pdo-pgsql=/usr/bin/pg_config
--enable-bcmath
--enable-fpm
--with-fpm-user=www-data
--with-fpm-group=www-data
--enable-mbstring
--enable-phpdbg
--enable-shmop
--enable-sockets
--enable-sysvmsg
--enable-sysvsem
--enable-sysvshm
--enable-zip
--with-libzip=/usr/lib/x86_64-linux-gnu
--with-zlib
--with-curl
--with-pear
--with-openssl
--enable-pcntl
--with-readline
Probably you won't need to remove any of the options except for
--with-pdo-pgsql=/usr/bin/pg_config
if PostgreSQL isn't installed. If you don't remove an option that is specific to a package that isn't installed, then this command will return an error message that tells you what option must be removed so that the command will run successfully.
Compile the binaries:
make # wait until make is finished
make install
Copy the PHP.ini file to the install directory
cp php.ini-development ~/bin/php-latest/lib/
Rename two files.
cd ~/bin/php-latest/etc/
mv php-fpm.conf.default php-fpm.conf
mv php-fpm.d/www.conf.default php-fpm.d/www.conf
Create symbolic links for your for your binary file.
cd ~/bin
ln -s php-latest/bin/php php
ln -s php-latest/bin/php-cgi php-cgi
ln -s php-latest/bin/php-config php-config
ln -s php-latest/bin/phpize phpize
ln -s php-latest/bin/phar.phar phar
ln -s php-latest/bin/pear pear
ln -s php-latest/bin/phpdbg phpdbg
ln -s php-latest/sbin/php-fpm php-fpm
Link your local PHP to the php command. You will need to logout then log back in for php to switch to the local version instead of the installed version from the default Ubuntu repositories.
# add this to .bashrc
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
Start PHP-FPM
sudo ~/bin/php-latest/sbin/php-fpm
If you run the above command as normal user without sudo, it will show the following notices:
NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root.
NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root.
Source: The Install file in php-src-master directory from https://github.com/php/php-src.git contains a link to https://php.net/install from which source these instructions were revised. In addition to several small revisions I added information about how to install PHP 7.3 locally in your home directory without requiring root permissions.
Install dependencies.
sudo apt install autoconf automake bison build-essential curl flex
libtool libssl-dev libcurl4-openssl-dev libxml2-dev libreadline7
libreadline-dev libsqlite3-dev libzip-dev libzip4 nginx openssl
pkg-config re2c sqlite3 zlib1g-dev
So you don't overwrite any existing PHP installs on your system, install PHP in your home directory. Create a directory for the PHP binaries.
mkdir -p ~/bin/php7-latest/
Download the PHP 7.3 from GitHub, decompress it, then change directories using
cd
to the new directory. You can also download PHP 7.3 from php.net/downloads.php and the installation instructions are exactly the same. Ordinarily this would be the preferred way of downloading PHP 7.3, but I'm using PHP 7.3 from https://github.com/php/ in this answer instead in order to match the PHP 7.3 archive that is asked about in the question.
Configure PHP. Remove any options you don't need (like MySQL or Postgres (--with-pdo-pgsql))
./configure --prefix=$HOME/bin/php-latest
--enable-mysqlnd
--with-pdo-mysql
--with-pdo-mysql=mysqlnd
--with-pdo-pgsql=/usr/bin/pg_config
--enable-bcmath
--enable-fpm
--with-fpm-user=www-data
--with-fpm-group=www-data
--enable-mbstring
--enable-phpdbg
--enable-shmop
--enable-sockets
--enable-sysvmsg
--enable-sysvsem
--enable-sysvshm
--enable-zip
--with-libzip=/usr/lib/x86_64-linux-gnu
--with-zlib
--with-curl
--with-pear
--with-openssl
--enable-pcntl
--with-readline
Probably you won't need to remove any of the options except for
--with-pdo-pgsql=/usr/bin/pg_config
if PostgreSQL isn't installed. If you don't remove an option that is specific to a package that isn't installed, then this command will return an error message that tells you what option must be removed so that the command will run successfully.
Compile the binaries:
make # wait until make is finished
make install
Copy the PHP.ini file to the install directory
cp php.ini-development ~/bin/php-latest/lib/
Rename two files.
cd ~/bin/php-latest/etc/
mv php-fpm.conf.default php-fpm.conf
mv php-fpm.d/www.conf.default php-fpm.d/www.conf
Create symbolic links for your for your binary file.
cd ~/bin
ln -s php-latest/bin/php php
ln -s php-latest/bin/php-cgi php-cgi
ln -s php-latest/bin/php-config php-config
ln -s php-latest/bin/phpize phpize
ln -s php-latest/bin/phar.phar phar
ln -s php-latest/bin/pear pear
ln -s php-latest/bin/phpdbg phpdbg
ln -s php-latest/sbin/php-fpm php-fpm
Link your local PHP to the php command. You will need to logout then log back in for php to switch to the local version instead of the installed version from the default Ubuntu repositories.
# add this to .bashrc
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
Start PHP-FPM
sudo ~/bin/php-latest/sbin/php-fpm
If you run the above command as normal user without sudo, it will show the following notices:
NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root.
NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root.
Source: The Install file in php-src-master directory from https://github.com/php/php-src.git contains a link to https://php.net/install from which source these instructions were revised. In addition to several small revisions I added information about how to install PHP 7.3 locally in your home directory without requiring root permissions.
edited Dec 31 '18 at 12:42
answered Dec 19 '18 at 10:36
karelkarel
58.6k13128147
58.6k13128147
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1102910%2fhow-to-build-php-7-3%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown