Skip to content

Commit a8c5e35

Browse files
committed
Works! Add php interpreter. Add php build script. Update README.
1 parent 46579b9 commit a8c5e35

File tree

5 files changed

+74
-2
lines changed

5 files changed

+74
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
build/
22
downloads/
3+
php/

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,4 +154,14 @@ foreach(_suffix_list ${CEF_HELPER_APP_SUFFIXES})
154154
)
155155
endforeach()
156156

157+
# Copy php binary
158+
add_custom_command(
159+
TARGET phpdesktop
160+
POST_BUILD
161+
COMMAND ${CMAKE_COMMAND} -E copy
162+
"${CMAKE_CURRENT_SOURCE_DIR}/php/php-cgi"
163+
"${PHPDESKTOP_APP}/Contents/MacOS/php-cgi"
164+
VERBATIM
165+
)
166+
157167
COPY_MAC_RESOURCES("${RESOURCES}" "" "phpdesktop" "${CMAKE_CURRENT_SOURCE_DIR}" "${PHPDESKTOP_APP}")

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@
77
3. Install [CMake](https://cmake.org/).
88
4. Install [Ninja](https://github.com/ninja-build/ninja).
99
5. Install Xcode and Xcode Command Line Tools.
10-
6. Run `cleanbuild.sh` script.
10+
6. Install PHP build dependencies. See https://www.php.net/manual/en/install.unix.source.php .
11+
6. Download PHP sources and extract the tar file to phpdesktop/php/ directory. So you should have for example a phpdesktop/php/php-8.x.x/ directory. See https://www.php.net/downloads.php .
12+
7. Run `buildphp.sh` script, but before running see the script comments to install requirements.
13+
8. Run `cleanbuild.sh` script.

buildphp.sh

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/bash
2+
3+
# This script builds with PHP extensions enabled: mysqli, pgsql
4+
# openssl, curl and zlib.
5+
6+
# REQUIREMENTS:
7+
8+
# 1. Download PHP sources from http://php.net/downloads.php
9+
# and extract them to "phpdesktop/php/" directory, so you
10+
# you should have "phpdesktop/php/php-x.x.x" directory.
11+
#
12+
# 2. Postgresql extension
13+
# >> brew install postgresql
14+
#
15+
# 3. Openssl support
16+
# >> brew install openssl
17+
#
18+
# 4. Curl support
19+
# >> brew install curl
20+
#
21+
# 5. Install pkg-config
22+
# >> brew install pkg-config
23+
#
24+
# 6. Install iconv
25+
# >> brew install libiconv
26+
27+
# How to enable other extensions?
28+
# Go to the build/php-xx/ directory and run the help command:
29+
# >> ./configure --help
30+
# Find the flag to enable the extension you want and add it in
31+
# the code below.
32+
33+
# Exit immediately if a command exits with a non-zero status.
34+
set -e
35+
36+
# Print all executed commands to terminal.
37+
set -x
38+
39+
clear && clear
40+
41+
root_dir=$(dirname $0)
42+
cd ${root_dir}/php/php*/
43+
php_dir=$(pwd)
44+
echo "Found PHP: ${php_dir}"
45+
echo "Configure PHP..."
46+
./configure \
47+
--prefix=${php_dir}/dist-install \
48+
--exec-prefix=${php_dir}/dist-install-exec-prefix \
49+
--with-mysqli \
50+
--with-pgsql=$(brew --prefix postgresql) \
51+
--with-openssl=$(brew --prefix openssl) \
52+
--with-curl=$(brew --prefix curl) \
53+
--with-zlib \
54+
--with-iconv=$(brew --prefix libiconv)
55+
echo "Build PHP..."
56+
make install
57+
cp ./dist-install-exec-prefix/bin/php-cgi ./../php-cgi
58+
echo "Done."

settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"listen_on": ["127.0.0.1", 0],
1313
"www_directory": "www",
1414
"index_files": ["index.html", "index.php"],
15-
"cgi_interpreter": "php-cgi-with-ext",
15+
"cgi_interpreter": "php-cgi",
1616
"cgi_extensions": ["php"],
1717
"404_handler": "/pretty-urls.php",
1818
"hide_files": []

0 commit comments

Comments
 (0)